class Chake::ConfigManager::Itamae
Public Class Methods
accept?(node)
click to toggle source
# File lib/chake/config_manager/itamae.rb, line 20 def self.accept?(node) node.data.key?('itamae') end
Public Instance Methods
apply(config)
click to toggle source
# File lib/chake/config_manager/itamae.rb, line 12 def apply(config) run_itamae(config) end
converge()
click to toggle source
# File lib/chake/config_manager/itamae.rb, line 8 def converge run_itamae(*node.data['itamae']) end
needs_upload?()
click to toggle source
# File lib/chake/config_manager/itamae.rb, line 16 def needs_upload? false end
Private Instance Methods
json_config()
click to toggle source
# File lib/chake/config_manager/itamae.rb, line 50 def json_config File.join(Chake.tmpdir, "#{node.hostname}.json") end
run_itamae(*recipes)
click to toggle source
# File lib/chake/config_manager/itamae.rb, line 26 def run_itamae(*recipes) cmd = ['itamae'] case node.connection when Chake::Connection::Ssh cmd << 'ssh' << "--user=#{node.username}" << "--host=#{node.hostname}" cmd += ssh_config when Chake::Connection::Local if node.username == 'root' cmd.prepend 'sudo' end cmd << 'local' else raise NotImplementedError, "Connection type #{node.connection.class} not supported for itamee" end cmd << "--node-json=#{json_config}" if node.silent cmd << '--log-level=warn' end cmd += recipes node.log("$ #{cmd.join(' ')}") io = IO.popen(cmd, 'r', err: %i[child out]) node.connection.read_output(io) end
ssh_config()
click to toggle source
# File lib/chake/config_manager/itamae.rb, line 54 def ssh_config ssh_config = node.connection.send(:ssh_config_file) # FIXME File.exist?(ssh_config) ? ["--ssh-config=#{ssh_config}"] : [] end