Sha256: add15e59cc36c96f69ff80c3276fa90056efdb3b9af0fb348bef143b769d9ec3

Contents?: true

Size: 976 Bytes

Versions: 5

Compression:

Stored size: 976 Bytes

Contents

require 'mattock/tasklib'

module LogicalConstruct
  class ChefSolo < Mattock::TaskLib
    default_namespace :chef_solo

    settings(
      :chef_solo_bin => "chef-solo",
      :daemonize => nil,
      :user => nil,
      :group => nil,
      :node_name => nil
    )

    setting :config_file

    def default_configuration(chef_config)
      super
      self.config_file = chef_config.solo_rb
    end

    def define
      in_namespace do
        Mattock::CommandTask.new(:run) do |task|
          task.command = Mattock::CommandLine.new(chef_solo_bin) do |cmd|
            cmd.options << "--config #{config_file}" unless config_file.nil?
            cmd.options << "--daemonize" if daemonize
            cmd.options << "--user #{user}" if user
            cmd.options << "--group #{group}" if group
            cmd.options << "--node_name #{node_name}" if node_name
          end
        end
      end
      bracket_task(:build_configs, :run, :provision)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
logical-construct-0.0.5 lib/logical-construct/target/chef-solo.rb
logical-construct-0.0.4 lib/logical-construct/target/chef-solo.rb
logical-construct-0.0.3 lib/logical-construct/target/chef-solo.rb
logical-construct-0.0.2 lib/logical-construct/target/chef-solo.rb
logical-construct-0.0.1 lib/logical-construct/target/chef-solo.rb