Sha256: 1606c064c2a15a469240783c2096c97288f8c5f345f2354034e027216f443b2a

Contents?: true

Size: 826 Bytes

Versions: 4

Compression:

Stored size: 826 Bytes

Contents

require 'shellwords'
require 'chake/config'
require 'chake/tmpdir'

module Chake
  class ConfigManager
    class ItamaeRemote < ConfigManager
      def converge
        run_itamae(*node.data['itamae-remote'])
      end

      def apply(config)
        run_itamae(config)
      end

      def needs_upload?
        true
      end

      def self.accept?(node)
        node.data.key?('itamae-remote')
      end

      private

      def run_itamae(*recipes)
        cmd = ['itamae', 'local', "--node-json=#{json_config}"]
        if node.silent
          cmd << '--log-level=warn'
        end
        cmd += recipes.map { |r| File.join(node.path, r) }
        node.run_as_root(Shellwords.join(cmd))
      end

      def json_config
        File.join(node.path, Chake.tmpdir, "#{node.hostname}.json")
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
chake-0.90.3 lib/chake/config_manager/itamae_remote.rb
chake-0.90.2 lib/chake/config_manager/itamae_remote.rb
chake-0.90.1 lib/chake/config_manager/itamae_remote.rb
chake-0.90 lib/chake/config_manager/itamae_remote.rb