Class: Wakame::Actions::DeployConfig
- Inherits:
-
Wakame::Action
- Object
- Wakame::Action
- Wakame::Actions::DeployConfig
- Defined in:
- lib/wakame/actions/deploy_config.rb
Constant Summary
Constants included from AttributeHelper
AttributeHelper::CLASS_TYPE_KEY, AttributeHelper::CONVERT_CLASSES, AttributeHelper::PRIMITIVE_CLASSES
Instance Attribute Summary
Attributes inherited from Wakame::Action
Instance Method Summary collapse
-
#initialize(svc) ⇒ DeployConfig
constructor
A new instance of DeployConfig.
- #run ⇒ Object
Methods inherited from Wakame::Action
#acquire_lock, #actor_request, #agent_monitor, #all_subactions_complete?, #flush_subactions, #master, #notes, #notify, #on_canceled, #on_failed, #service_cluster, #status=, #subactions, #sync_actor_request, #trigger_action, #walk_subactions
Methods included from ThreadImmutable
#bind_thread, included, #target_thread, #target_thread?, #thread_check
Methods included from AttributeHelper
#dump_attrs, #retrieve_attr_attribute
Constructor Details
#initialize(svc) ⇒ DeployConfig
Returns a new instance of DeployConfig.
4 5 6 |
# File 'lib/wakame/actions/deploy_config.rb', line 4 def initialize(svc) @svc = svc end |
Instance Method Details
#run ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/wakame/actions/deploy_config.rb', line 8 def run Wakame.log.debug("#{self.class}: run() Begin: #{@svc.resource.class}") raise "CloudHost is not mapped Agent: CloudHost.id=#{@svc.cloud_host.id}" unless @svc.cloud_host.mapped? acquire_lock(@svc.resource.class.to_s) begin tmpl = Wakame::Template.new(@svc) tmpl.render_config src_path = tmpl.tmp_basedir.dup src_path.sub!('/$', '') if File.directory? src_path dest_path = File.("tmp/config/" + File.basename(tmpl.basedir), @svc.cloud_host.root_path) #Wakame::Util.exec("rsync -e 'ssh -i #{Wakame.config.ssh_private_key} -o \"UserKnownHostsFile #{Wakame.config.ssh_known_hosts}\"' -au #{src_path}/ root@#{@svc.cloud_host.agent_ip}:#{dest_path}") Wakame::Util.exec("rsync -e 'ssh -i #{Wakame.config.ssh_private_key} -o \"StrictHostKeyChecking no\"' -au #{src_path}/ root@#{@svc.cloud_host.agent_ip}:#{dest_path}") ensure tmpl.cleanup if tmpl end Wakame.log.debug("#{self.class}: run() End: #{@svc.resource.class}") end |