Class: Proctor::Command::FileExportCmd
- Inherits:
-
Object
- Object
- Proctor::Command::FileExportCmd
- Includes:
- Helpers::Command, Resource::Erb, Resource::Lookup
- Defined in:
- lib/proctor/command/file_export_cmd.rb
Instance Method Summary collapse
- #export ⇒ Object
-
#initialize(global, options, args) ⇒ FileExportCmd
constructor
A new instance of FileExportCmd.
Methods included from Resource::Lookup
#lookup_valid_group_template, #lookup_valid_manager, #lookup_valid_node, #lookup_valid_service, #lookup_valid_service_template, #lookup_valid_services, #lookup_valid_services_hash
Methods included from Resource::Erb
#erb_ify, #erb_ify_hash, #erb_ify_services, #generate_group_erb, #generate_group_header, #generate_service_erb, #generate_service_header, #render_group_template, #render_service_template
Methods included from Helpers::Command
#check_number_of_args, #options_msg
Constructor Details
#initialize(global, options, args) ⇒ FileExportCmd
Returns a new instance of FileExportCmd.
13 14 15 16 17 18 19 |
# File 'lib/proctor/command/file_export_cmd.rb', line 13 def initialize(global, , args) @env = ['env'] @manager = args[0] @node = args[1] opts = {'MANAGERS' => @env.managers.names, 'NODES' => @env.nodes.names} check_number_of_args(args, 2, 'file_export MANAGER NODE', opts) end |
Instance Method Details
#export ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/proctor/command/file_export_cmd.rb', line 21 def export manager = lookup_valid_manager(@manager, @env) #update_manager_with_cl_options(manager) node = lookup_valid_node(@node, @env) if manager.data["group_data"] services = lookup_valid_services_hash(node.name, @env) template = lookup_valid_group_template(manager.name, node.name, @env) text = render_group_template(manager, node, services, template, @env) write_group_text_to_disk(manager, node, text, @env) end if manager.data["service_data"] node.services.each do |service_name| service = lookup_valid_service(service_name, @env) template = lookup_valid_service_template(manager.name, service.name, @env) text = render_service_template(manager, service, template, @env) write_service_text_to_disk(manager, service, text, @env) end end nil end |