Module: Chef::Knife::ZeroBase

Included in:
ZeroApply, ZeroBootstrap, ZeroConverge, ZeroDiagnose
Defined in:
lib/chef/knife/zero_base.rb

Class Method Summary collapse

Class Method Details

.included(includer) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/chef/knife/zero_base.rb', line 9

def self.included(includer)
  includer.class_eval do
    deps do
      Chef::Config[:local_mode] = true
      ## deprecated CHEF-18.
      ## TODO: should implement unix domain socket forwarding (~< net-ssh 4.1.0) before will be removed.
      Chef::Config[:listen]     = true
      Chef::Config[:knife_zero] = {}
      Chef::Knife::Ssh.load_deps
    end

    ## Added by Knife-Zero
    option :why_run,
           short: '-W',
           long: '--why-run',
           description: 'Enable whyrun mode on chef-client run at remote node.',
           boolean: true

    option :remote_chef_zero_port,
           long: '--remote-chef-zero-port PORT',
           description: 'Listen port on remote',
           default: nil,
           proc: proc { |key| Chef::Config[:remote_chef_zero_port] = key.to_i }

    option :alter_project,
           long: '--alter-project PROJECT',
           proc: proc { |u| Chef::Config[:alter_project] = u },
           description: 'Products used on remote nodes',
           default: 'chef',
           in: %w{chef cinc}

    option :node_config_file,
           long: '--node-config PATH_TO_CONFIG',
           proc: proc { |u| Chef::Config[:node_config_file] = u },
           description: 'The configuration file to use on remote node',
           default: '/etc/' + ChefUtils::Dist::Infra::DIR_SUFFIX + '/client.rb'
  end
end