Class: ZoneCreate
Instance Attribute Summary
Attributes inherited from Command
#desc, #name
Instance Method Summary
collapse
Methods inherited from Command
#add_arg, #add_cmd, #add_flow, #add_flow_from_usage, #add_input, #add_option, #add_options, #command_name?, #flow_passes_parse, #flow_passes_preconditions, #get_args_used, #init, #initialize, #option_help_string, #run, #show_help, #show_help_option
Constructor Details
This class inherits a constructor from Command
Instance Method Details
#create_args ⇒ Object
119
120
121
122
123
124
|
# File 'lib/zone.rb', line 119
def create_args
add_arg("name", "name of zone", /[[:alnum:]\.-]+/)
add_arg("comment", "zone comment", /.*/)
add_arg("status", "zone status", 'zone_statuses')
add_arg("type", "zone type", 'zone_types')
end
|
#create_flows ⇒ Object
126
127
128
|
# File 'lib/zone.rb', line 126
def create_flows
add_flow_from_usage("<name> <status> [<comment>] [<type>='Primary']")
end
|
#execute(arghash, rest) ⇒ Object
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
# File 'lib/zone.rb', line 130
def execute(arghash, rest)
name = arghash["name"]
zone_command = @input["zone"]
if name[-1] != '.'
name = name + '.'
end
status = arghash["status"]
= arghash["comment"]
= "" if .nil?
type = arghash["type"]
dputs "name = #{name}, comment=#{}, status=#{status}, type=#{type}"
zone = { "Comment" => , "DomainName" => name, "Status" => status, "ZoneType" => type }
puts "creating zone on server"
Route.do.untranslate_zone(zone)
new_zone = Route.do.add_zone(zone)
Route.do.translate_zone(new_zone)
zone_command.write_new_zone(new_zone)
end
|