Module: ChefWorkstationInitialize::SelfBootstrap::NoChef::SelfBootstrapHelpers

Instance Attribute Summary collapse

Attributes included from WorkstationHelpers

#workstationobj

Instance Method Summary collapse

Methods included from WorkstationResourceHelpers

#default_workstation_data, #get_workstation, #set_workstation_data, #set_workstation_resource, #swap_workstation, #workstation_resource, #workstation_resource_keys

Methods included from WorkstationHelpers

#auto_repo, #bootstrapping_progress_file, #change_unix_permission, #create_main_generator, #main_generator_name, #new_cookbook_name, #node_infra_chef, #prepare_new_resource, #project_name, #workstation_acl_path, #workstation_berks_vendor_dir, #workstation_cache_dir, #workstation_cache_options_syntaxe_path, #workstation_cache_path, #workstation_checksum_path, #workstation_chef_environments_dir, #workstation_chef_repo_path, #workstation_client_d_dir, #workstation_client_key_path, #workstation_client_path, #workstation_config_d_dir, #workstation_config_dir, #workstation_container_path, #workstation_cookbook_artifact_path, #workstation_cookbooks_dir, #workstation_data_bags_dir, #workstation_download_dir, #workstation_file, #workstation_file_backup_path, #workstation_file_cache_path, #workstation_generators_dir, #workstation_group_path, #workstation_libraries_dir, #workstation_logs_dir, #workstation_nodes_dir, #workstation_ohai_segment_plugin_path, #workstation_policy_dir, #workstation_policy_files_dir, #workstation_policy_group_dir, #workstation_resources_dir, #workstation_roles_dir, #workstation_scripts_dir, #workstation_solo_d_dir, #workstation_syntax_check_cache_path, #workstation_trusted_certs_dir, #workstation_user_path

Methods included from UsersHelpers

#create_group, #create_user, #generate_secret, #generate_ssh_user_key, #generate_user_data, #secretdatabag, #secretdatabagitem, #secretdatabagkey, #set_cookbook_user_secret_key, #user_fully_created?, #userdatabag

Methods included from UpdateHelpers

#commit_state

Methods included from KnifeHelpers

#get_solo_cmd, #is_knife?, #knife, #knife_get_node_attribute, #knife_search_self_cmd, #knife_self_bootstrap_cmd, #self_bootstrap_options

Methods included from ChefRepoHelpers

#create_attribute_file, #create_chef_additionnal_dir, #create_chef_infra_cookbook, #create_cookbook, #create_generator, #create_recipe, #create_template_file, #define_cron_job, #ensure_main_environment, #project_environment_json, #project_role_json, #render_template, #write_Solo_file, #write_kitchen_file, #write_main_environment, #write_main_role, #write_main_role_environment, #write_role_environment

Methods included from KitchenHelpers

#building_kitchen, #generate_kitchen, #generate_machine, #is_kitchen_command?, #kitchen, #kitchen_machine, #kitchen_root

Methods included from ProvisionersHelpers

#chef_zero_provisioner, #provisioners

Methods included from PlatformsHelpers

#default_platforms

Methods included from SuitesHelpers

#default_suites

Methods included from VerifiersHelpers

#inspec_verifier, #verifiers

Methods included from ChefHelpers

#chef, #chef_client, #install_chef_workstation, #is_chef_cli_command?, #is_chef_client_command?, #is_chef_command?, #is_chef_enabled?, #is_chef_installed?, #is_chef_profile_set?, #is_chefworkstation_available?, #is_knife_gem_install?

Methods included from BerksHelpers

#berks, #berks_vendor, #berks_vendor_all_cookbook, #berks_vendor_cookbook, #berks_vendor_init, #delete_all_berkslock, #delete_cookbook_berkslock, #reset_berks_vendor_dir, #self_berks_vendor

Methods included from GitHelpers

#all_cookbooks, #generate_git_submodules, #generate_json_repo, #get_git_path, #get_git_relative_path, #get_git_server, #get_git_submodule, #get_self_git, #git_exec, #git_submodule_init, #repository_list

Methods included from SSHHelpers

#delete_hostkey, #delete_hostkey_ip_or_name, #generate_private_key, #ssh, #ssh_command, #ssh_keygen

Methods included from CommandlineHelpers

#base_command, #get_homedir, #is_mixlib_disabled?, #main_command, #run_options

Methods included from DefaultMethodsHelpers

#analyse_object, #check_install_dir, #debug_worklog, #default_chefzero_portrange, #default_hostname, #default_install_dir, #define_resource_requirements, #error_worklog, #generate_default_install_dir, #generate_directory, #get_out_of_cache_path, #get_out_of_folder, #get_out_of_local_chef_path, #get_path, #is_chef_constant_enabled?, #parent_nil?, #require_implement_method, #search_local_project_folder, #warning_worklog, #worklog, #worklog_counter

Instance Attribute Details

#force_solo ⇒ Object

Returns the value of attribute force_solo.



20
21
22
# File 'lib/selfbootstrap/nochef/selfbootstrap.rb', line 20

def force_solo
  @force_solo
end

Instance Method Details

#boostrapp_once ⇒ Object



134
135
136
137
138
139
140
141
142
143
144
145
# File 'lib/selfbootstrap/nochef/selfbootstrap.rb', line 134

def boostrapp_once
  create_chef_additionnal_dir
  berks_vendor_init unless is_self_bootsrapping?
  unless ::File.exist?(bootstrapping_progress_file)
    FileUtils.touch bootstrapping_progress_file unless is_self_bootsrapping?
    change_unix_permission if is_self_bootsrapping?
    bootstrap_self_command
    change_unix_permission if is_self_bootsrapping?
    remove_bootstrap_file
    exit 0 if is_self_bootsrapping?
  end
end

#boostrapped? ⇒ Boolean

Returns:

  • (Boolean)


183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
# File 'lib/selfbootstrap/nochef/selfbootstrap.rb', line 183

def boostrapped?
  return false if for_search_local_node?

  begin
    result = JSON.parse(knife_search_self_cmd)
    debug_worklog('Searching result' + result.to_s)
    rows = result['rows']
    get_runlist = nil
    rows.each do |row|
      unless row['run_list'].nil?
        get_runlist += row['run_list']
      end
    end

    !get_runlist.nil?
  rescue JSON::ParserError => json_parse_error
    worklog "Force solo as not able to parse json in: #{json_parse_error.inspect}"
    boostrapped = false
    @force_solo = true
  rescue StandardError => std_bootstrap_err
    worklog "Not able to validate if bootrapped as: #{std_bootstrap_err.inspect}"
    @force_solo = true
    boostrapped = false
  end
  boostrapped
end

#bootstrap_self ⇒ Object



162
163
164
165
166
167
168
# File 'lib/selfbootstrap/nochef/selfbootstrap.rb', line 162

def bootstrap_self
  # worklog "Bootstrap #{default_hostname} with skip #{skip_boostrap?}::#{boostrapped?}"
  unless skip_boostrap? || boostrapped?
    worklog 'machine not boostrapped'
    boostrapp_once
  end
end

#bootstrap_self_command ⇒ Object



111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/selfbootstrap/nochef/selfbootstrap.rb', line 111

def bootstrap_self_command
  if is_solo?
    debug_worklog 'boostrapped with solo'
    if chefworkstation_available?
      if chef_enabled?
        prepend ChefWorkstationInitialize::SelfBootstrap::WithChef
        bootstrap_self_command
      else
        require 'kitchen'
        require 'chef'
        require 'chef/workstation_config_loader'
      end
    elsif run_as_root?
      chef_client_self_bootstrap_cmd
    else
      restart_bootstrap
    end
  else
    knife_self_bootstrap_cmd
  end
  debug_worklog 'bootstrap self command completed'
end

#chef_client_self_bootstrap_cmd ⇒ Object



147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/selfbootstrap/nochef/selfbootstrap.rb', line 147

def chef_client_self_bootstrap_cmd
  debug_worklog 'boostrapped with solo and chef-client'

  chef_client_options = [self_bootstrap_options]
  chef_client_options << "--runlist #{project_name}"
  if ::File.exist?('solo.rb')
    chef_client_options << '-c solo.rb'
  else
    chef_client_options << chef_solo_options_command
    chef_client_options << "--chef-zero-host #{default_hostname}"
    chef_client_options << "--chef-zero-port #{default_chefzero_portrange}"
  end
  chef_client chef_client_options, debug: true
end

#chef_solo_options ⇒ Object



54
55
56
57
58
# File 'lib/selfbootstrap/nochef/selfbootstrap.rb', line 54

def chef_solo_options
  solo_options.each do |opt, value|
    send(opt, JSON.generate(JSON.generate(value).encode)) unless value.nil? || !respond_to?(opt)
  end
end

#chef_solo_options_command ⇒ Object



68
69
70
71
72
73
74
75
76
# File 'lib/selfbootstrap/nochef/selfbootstrap.rb', line 68

def chef_solo_options_command
  solo_options.map do |opt, value|
    encode_value = JSON.generate(value).encode
    unless value.is_a? String
      encode_value = JSON.generate(JSON.generate(value).encode)
    end
    "--config-option #{opt}=#{encode_value}"
  end.join(' ')
end

#chef_solo_options_encode ⇒ Object



60
61
62
63
64
65
66
# File 'lib/selfbootstrap/nochef/selfbootstrap.rb', line 60

def chef_solo_options_encode
  chef_solo_options_str = ''
  solo_options.each do |opt, value|
    chef_solo_options_str += "#{opt} #{JSON.generate(JSON.generate(value).encode)}\n"
  end
  chef_solo_options_str
end

#for_search_local_node? ⇒ Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/selfbootstrap/nochef/selfbootstrap.rb', line 26

def for_search_local_node?
  is_knife? && ARGV.join(' ').include?("search node name:#{default_hostname} --format json -z")
end

#for_solo? ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/selfbootstrap/nochef/selfbootstrap.rb', line 22

def for_solo?
  is_knife? && ARGV.join(' ').include?('config show solo --format json')
end

#install_this_gem ⇒ Object



82
83
84
# File 'lib/selfbootstrap/nochef/selfbootstrap.rb', line 82

def install_this_gem
  chef 'gem install selfbootstrap', { as_system: true }
end

#is_boostrapping? ⇒ Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/selfbootstrap/nochef/selfbootstrap.rb', line 34

def is_boostrapping?
  is_chef_enabled? ? ::File.exist?(bootstrapping_progress_file) : false
end

#is_self_bootsrapping? ⇒ Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/selfbootstrap/nochef/selfbootstrap.rb', line 30

def is_self_bootsrapping?
  is_kitchen_command? && ARGV.join(' ').include?('list bootstrap self')
end

#is_solo? ⇒ Boolean

Returns:

  • (Boolean)


170
171
172
173
174
175
176
177
178
179
180
181
# File 'lib/selfbootstrap/nochef/selfbootstrap.rb', line 170

def is_solo?
  force_solo || (
    if skip_boostrap?
      debug_worklog('Checking solo from workstation resource')
      workstation_resource[:solo]
    else
      json_parse = JSON.parse(get_solo_cmd)
      debug_worklog("is solo parse = #{json_parse}")
      json_parse.nil? ? workstation_resource[:solo] : json_parse['solo']
    end
  )
end

#remove_bootstrap_file ⇒ Object



78
79
80
# File 'lib/selfbootstrap/nochef/selfbootstrap.rb', line 78

def remove_bootstrap_file
  FileUtils.rm bootstrapping_progress_file if ::File.exist?(bootstrapping_progress_file)
end

#restart_bootstrap ⇒ Object



86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/selfbootstrap/nochef/selfbootstrap.rb', line 86

def restart_bootstrap
  rerun_opt = { sudo: true }
  if run_as_root?
    install_chef_workstation
    set_chef_profile
    install_this_gem
    rerun_opt[:as_system] = true
  end
  worklog 'Self bootstrap with sudo command'
  debug_worklog 'boostrapped with solo and kitchen and root'
  remove_bootstrap_file
  exit base_command('selfbootstrap', ARGV, rerun_opt)
  # kitchen 'list bootstrap self', sudo: true
end

#run_as_root? ⇒ Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/selfbootstrap/nochef/selfbootstrap.rb', line 42

def run_as_root?
  ENV['USER'] == 'root' # workstation_resource[:user] == 'root'
end

#set_chef_profile ⇒ Object



101
102
103
104
105
106
107
108
109
# File 'lib/selfbootstrap/nochef/selfbootstrap.rb', line 101

def set_chef_profile
  bash_file = '/etc/bash.bashrc'
  # chef_shell_cmd = "cd #{workstation_scripts_dir}; curl -L https://omnitruck.chef.io/install_desktop.sh | sudo bash -s -- #{project_name} #{environments.join(' ')}"
  chef_shell_cmd = 'eval "$(chef shell-init bash)"'
  debug_worklog "Set chef profile to #{bash_file}"
  open(bash_file, 'a') do |f|
    f.puts chef_shell_cmd
  end unless ::File.read(bash_file).include?(chef_shell_cmd)
end

#skip_boostrap? ⇒ Boolean

Returns:

  • (Boolean)


46
47
48
49
50
51
52
# File 'lib/selfbootstrap/nochef/selfbootstrap.rb', line 46

def skip_boostrap?
  debug_worklog("for_solo = #{for_solo?}")
  debug_worklog("for_search_local_node = #{for_search_local_node?}")
  debug_worklog("unauthorized_to_boostrap = #{unauthorized_to_boostrap?}")
  debug_worklog("is_boostrapping = #{is_boostrapping?}")
  for_solo? || for_search_local_node? || unauthorized_to_boostrap? || is_boostrapping?
end

#solo_options ⇒ Object



210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
# File 'lib/selfbootstrap/nochef/selfbootstrap.rb', line 210

def solo_options
  {
    chef_repo_path: get_path(workstation_chef_repo_path),
    cookbook_path: [
      get_path(workstation_cookbooks_dir),
      get_path(workstation_libraries_dir),
      get_path(workstation_resources_dir),
      get_path(workstation_berks_vendor_dir),
    ],
    data_bags_path: get_path(workstation_data_bags_dir),
    environment_path: get_path(workstation_chef_environments_dir),
    node_path: get_path(workstation_nodes_dir),
    policy_group_path: get_path(workstation_policy_group_dir),
    policy_path: get_path(workstation_policy_dir),
    role_path: get_path(workstation_roles_dir),
    solo: is_solo?,
    log_location: ::File.join(get_path(workstation_logs_dir), "#{project_name}_#{workstation_resource[:user]}.log"),
    cache_options: {
      path: get_path(workstation_cache_options_syntaxe_path),
    },
    cache_path: get_path(workstation_cache_path),
    checksum_path: get_path(workstation_checksum_path),
    acl_path: get_path(workstation_acl_path),
    client_d_dir: get_path(workstation_client_d_dir),
    client_key_path: get_path(workstation_client_key_path),
    client_path: get_path(workstation_client_path),
    color: true,
    config_d_dir: get_path(workstation_config_d_dir),
    config_dir: get_path(workstation_config_dir),
    container_path: get_path(workstation_container_path),
    cookbook_artifact_path: get_path(workstation_cookbook_artifact_path),
    enable_reporting: false,
    file_backup_path: get_path(workstation_file_backup_path),
    file_cache_path: get_path(workstation_file_cache_path),
    group: workstation_resource[:group],
    group_path: get_path(workstation_group_path),
    lockfile: ::File.join(get_path(workstation_file_cache_path), 'chef-client-running.pid'),
    node_name: default_hostname,
    ohai_segment_plugin_path: get_path(workstation_ohai_segment_plugin_path),
    solo_d_dir: get_path(workstation_solo_d_dir),
    user: workstation_resource[:user],
    user_home: workstation_resource[:home],
    user_path: get_path(workstation_user_path),
    syntax_check_cache_path: get_path(workstation_syntax_check_cache_path),
    trusted_certs_dir: get_path(workstation_trusted_certs_dir),
    validation_client_name: "#{project_name}-chef-validator",
    data_bag_encrypt_version: 3,
  #   # client_key               "#{current_dir}/<%= @workstation_resource[:gitinfo]user %>.pem"
  #   # chef_server_url          "https://chef.jimbodragon.qc.to/organizations/<%= @workstation_resource[:gitinfo]project_name %>"
  #   # acl_path: /root/acls,
  #   # allowed_automatic_attributes: nil,
  #   # allowed_default_attributes: nil,
  #   # allowed_normal_attributes: nil,
  #   # allowed_override_attributes: nil,
  #   # always_dump_stacktrace: false,
  #   # authentication_protocol_version: 1.1,
  #   # automatic_attribute_blacklist: nil,
  #   # automatic_attribute_whitelist: nil,
  #   # blocked_automatic_attributes: nil,
  #   # blocked_default_attributes: nil,
  #   # blocked_normal_attributes: nil,
  #   # blocked_override_attributes: nil,
  #   # cache_options: {
  #   #   path: /root/.chef/syntaxcache
  #   # },
  #   # cache_path: /root/.chef/local-mode-cache,
  #   # checksum_path: /root/.chef/local-mode-cache/checksums,
  #   # chef_guid: nil,
  #   # chef_guid_path: /root/.chef/chef_guid,
  #   # chef_repo_path: /root,
  #   # chef_server_root: chefzero://localhost: 1,
  #   # chef_server_url: chefzero://localhost: 1,
  #   # chef_zero: {
  #   #   enabled: true,
  #   #   host: localhost,
  #   #   osc_compat: false,
  #   #   port: #<Enumerator: 0x000000000136d318>,
  #   #   single_org: chef
  #   # },
  #   # chefcli: nil,
  #   # chefdk: nil,
  #   # clear_gem_sources: nil,
  #   # client_d_dir: /root/.chef/client.d,
  #   # client_fork: nil,
  #   # client_key: nil,
  #   # client_key_contents: nil,
  #   # client_key_path: /root/client_keys,
  #   # client_path: /root/clients,
  #   # client_registration_retries: 5,
  #   # color: true,
  #   # config_d_dir: /root/.chef/config.d,
  #   # config_dir: /root/.chef/,
  #   # config_file: nil,
  #   # container_path: /root/containers,
  #   # cookbook_artifact_path: /root/cookbook_artifacts,
  #   # cookbook_path: [
  #   #   #{current_dir}/cookbooks,
  #   #   #{current_dir}/libraries,
  #   #   #{current_dir}/resources
  #   # ],
  #   # cookbook_sync_threads: 10,
  #   # count_log_resource_updates: false,
  #   # data_bag_decrypt_minimum_version: 0,
  #   # data_bag_encrypt_version: 3,
  #   # data_bags_path: /root/data_bags,
  #   # data_collector: {
  #   #   mode: both,
  #   #   organization: chef_solo,
  #   #   raise_on_failure: false,
  #   #   server_url: nil,
  #   #   token: nil
  #   # },
  #   # default_attribute_blacklist: nil,
  #   # default_attribute_whitelist: nil,
  #   # deployment_group: nil,
  #   # diff_disabled: false,
  #   # diff_filesize_threshold: 10000000,
  #   # diff_output_threshold: 1000000,
  #   # disable_event_loggers: false,
  #   # download_progress_interval: 10,
  #   # enable_reporting: true,
  #   # enable_reporting_url_fatals: false,
  #   # enable_selinux_file_permission_fixup: true,
  #   # encrypted_data_bag_secret: nil,
  #   # enforce_default_paths: false,
  #   # enforce_path_sanity: false,
  #   # environment_path: /root/environments,
  #   # event_handlers: nil,
  #   # event_loggers: nil,
  #   # exception_handlers: nil,
  #   # ez: false,
  #   # file_atomic_update: true,
  #   # file_backup_path: /root/.chef/local-mode-cache/backup,
  #   # file_cache_path: /root/.chef/local-mode-cache/cache,
  #   # file_staging_uses_destdir: auto,
  #   # fips: false,
  #   # follow_client_key_symlink: false,
  #   # force_formatter: false,
  #   # force_logger: false,
  #   # formatter: null,
  #   # formatters: nil,
  #   # group: nil,
  #   # group_path: /root/groups,
  #   # group_valid_regex: (?-mix:^[^-+~: nil,\t\r\n\f\0]+[^: nil,\t\r\n\f\0]*$),
  #   # http_disable_auth_on_redirect: true,
  #   # http_retry_count: 5,
  #   # http_retry_delay: 5,
  #   # internal_locale: C.UTF-8,
  #   # interval: nil,
  #   # json_attribs: nil,
  #   # knife: {
  #   #   hints: nil
  #   # },
  #   # listen: false,
  #   # local_key_generation: true,
  #   # local_mode: true,
  #   # lockfile: /root/.chef/local-mode-cache/cache/chef-client-running.pid,
  #   # log_level: info,
  #   # log_location: STDERR,
  #   # minimal_ohai: false,
  #   # named_run_list: nil,
  #   # no_lazy_load: true,
  #   # node_name: root,
  #   # node_path: /root/nodes,
  #   # normal_attribute_blacklist: nil,
  #   # normal_attribute_whitelist: nil,
  #   # ohai: {
  #   #   critical_plugins: nil,
  #   #   disabled_plugins: nil,
  #   #   hints_path: /etc/chef/ohai/hints,
  #   #   log_level: auto,
  #   #   log_location: #<IO: 0x000000000097b7d8>,
  #   #   optional_plugins: nil,
  #   #   plugin: nil,
  #   #   plugin_path: nil,
  #   #     /opt/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/ohai-16.6.5/lib/ohai/plugins,
  #   #     /etc/chef/ohai/plugins,
  #   #   run_all_plugins: false,
  #   #   shellout_timeout: 30
  #   # },
  #   # ohai_segment_plugin_path: /root/.chef/ohai/cookbook_plugins,
  #   # once: nil,
  #   # override_attribute_blacklist: nil,
  #   # override_attribute_whitelist: nil,
  #   # pid_file: nil,
  #   # policy_document_native_api: true,
  #   # policy_group: nil,
  #   # policy_group_path: /root/policy_groups,
  #   # policy_name: nil,
  #   # policy_path: /root/policies,
  #   # profile: nil,
  #   # recipe_url: nil,
  #   # repo_mode: hosted_everything,
  #   # report_handlers: nil,
  #   # resource_unified_mode_default: false,
  #   # rest_timeout: 300,
  #   # role_path: /root/roles,
  #   # ruby_encoding: UTF-8,
  #   # rubygems_cache_enabled: false,
  #   # rubygems_url: nil,
  #   # run_lock_timeout: nil,
  #   # script_path: nil,
  #   # show_download_progress: false,
  #   # silence_deprecation_warnings: nil,
  #   # solo: false,
  #   # solo_d_dir: /root/.chef/solo.d,
  #   # solo_legacy_mode: false,
  #   # splay: nil,
  #   # ssh_agent_signing: false,
  #   # ssl_ca_file: nil,
  #   # ssl_ca_path: nil,
  #   # ssl_client_cert: nil,
  #   # ssl_client_key: nil,
  #   # ssl_verify_mode: verify_peer,
  #   # start_handlers: nil,
  #   # stream_execute_output: false,
  #   # syntax_check_cache_path: /root/.chef/syntaxcache,
  #   # target_mode: {
  #   #   enabled: false,
  #   #   protocol: ssh
  #   # },
  #   # treat_deprecation_warnings_as_errors: false,
  #   # trusted_certs_dir: /root/.chef/trusted_certs,
  #   # umask: 18,
  #   # user: nil,
  #   # user_home: /root,
  #   # user_path: /root/users,
  #   # user_valid_regex: (?-mix:^[^-+~: nil,\t\r\n\f\0]+[^: nil,\t\r\n\f\0]*$),
  #   # validation_client_name: chef-validator,
  #   # validation_key: nil,
  #   # validation_key_contents: nil,
  #   # verbose_logging: true,
  #   # verify_api_cert: true,
  #   # why_run: false,
  #   # windows_service: {
  #   #   watchdog_timeout: 7200
  #   # },
  #   # zypper_check_gpg: true,
  }
end

#unauthorized_to_boostrap? ⇒ Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/selfbootstrap/nochef/selfbootstrap.rb', line 38

def unauthorized_to_boostrap?
  is_chef_command? || is_chef_client_command? || is_chef_cli_command?
end