Module: ChefWorkstationInitialize::SelfBootstrap::WithChef::CommandlineHelpers

Includes:
DefaultMethodsHelpers
Included in:
GitHelpers
Defined in:
lib/selfbootstrap/withchef/commandline.rb

Instance Attribute Summary

Attributes included from NoChef::SelfBootstrapHelpers

#force_solo

Attributes included from NoChef::WorkstationHelpers

#workstationobj

Instance Method Summary collapse

Methods included from DefaultMethodsHelpers

#generate_directory, #worklog

Methods included from NoChef::SelfBootstrapHelpers

#boostrapp_once, #boostrapped?, #bootstrap_self, #bootstrap_self_command, #chef_client_self_bootstrap_cmd, #chef_solo_options, #chef_solo_options_command, #chef_solo_options_encode, #for_search_local_node?, #for_solo?, #install_this_gem, #is_boostrapping?, #is_self_bootsrapping?, #is_solo?, #remove_bootstrap_file, #restart_bootstrap, #run_as_root?, #set_chef_profile, #skip_boostrap?, #solo_options, #unauthorized_to_boostrap?

Methods included from NoChef::WorkstationResourceHelpers

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

Methods included from NoChef::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 NoChef::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 NoChef::UpdateHelpers

#commit_state

Methods included from NoChef::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 NoChef::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 NoChef::KitchenHelpers

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

Methods included from NoChef::ProvisionersHelpers

#chef_zero_provisioner, #provisioners

Methods included from NoChef::PlatformsHelpers

#default_platforms

Methods included from NoChef::SuitesHelpers

#default_suites

Methods included from NoChef::VerifiersHelpers

#inspec_verifier, #verifiers

Methods included from NoChef::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 NoChef::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 NoChef::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 NoChef::SSHHelpers

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

Methods included from NoChef::CommandlineHelpers

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

Methods included from NoChef::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 Method Details

#run_options(run_opts = {}) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/selfbootstrap/withchef/commandline.rb', line 20

def run_options(run_opts = {})
  # debug_worklog run_opts.inspect
  env = {}
  if workstation_resource[:user]
    run_opts[:user] = workstation_resource[:user]
    # Certain versions of `git` misbehave if git configuration is
    # inaccessible in $HOME. We need to ensure $HOME matches the
    # user who is executing `git` not the user running Chef.
    env['HOME'] = get_homedir(workstation_resource[:user])
  end
  run_opts[:group] = workstation_resource[:group] if workstation_resource[:group]
  env['GIT_SSH'] = workstation_resource[:ssh_wrapper] if workstation_resource[:ssh_wrapper]
  run_opts[:log_tag] = workstation_resource[:log_tag] if workstation_resource[:log_tag]
  run_opts[:timeout] = workstation_resource[:timeout] if workstation_resource[:timeout]
  env.merge!(workstation_resource[:environment_variables]) if workstation_resource[:environment_variables]
  run_opts[:environment] = env unless env.empty?
  super(run_opts)
end