Class: ForemanMaintain::Cli::PrebuildBashCompletionCommand

Inherits:
Base
  • Object
show all
Includes:
ForemanMaintain::Concerns::SystemHelpers
Defined in:
lib/foreman_maintain/cli/advanced/prebuild_bash_completion.rb

Constant Summary

Constants included from ForemanMaintain::Concerns::OsFacts

ForemanMaintain::Concerns::OsFacts::FALLBACK_OS_RELEASE_FILE, ForemanMaintain::Concerns::OsFacts::OS_RELEASE_FILE

Instance Attribute Summary

Attributes inherited from Base

#runner

Instance Method Summary collapse

Methods included from ForemanMaintain::Concerns::SystemHelpers

#check_max_version, #check_min_version, #command_present?, #create_lv_snapshot, #directory_empty?, #execute!, #execute?, #execute_runner, #execute_with_status, #file_exists?, #file_nonzero?, #find_dir_containing_file, #find_package, #find_symlinks, #foreman_plugin_name, #format_shell_args, #get_lv_info, #get_lv_path, #hammer_package, #hammer_plugin_name, #hostname, included, #package_manager, #package_version, #packages_action, #parse_csv, #parse_json, #proxy_plugin_name, #repository_manager, #ruby_prefix, #server?, #shellescape, #systemd_installed?, #version

Methods included from ForemanMaintain::Concerns::OsFacts

#centos?, #cpu_cores, #deb_major_version, #debian?, #debian_or_ubuntu?, #el7?, #el8?, #el?, #el_major_version, #el_short_name, #facts, #memory, #os_id, #os_id_like_list, #os_name, #os_release_file, #os_version, #os_version_codename, #os_version_id, #rhel?, #ubuntu?, #ubuntu_major_version

Methods included from ForemanMaintain::Concerns::Finders

#check, #detector, #feature, #find_all_scenarios, #find_checks, #find_procedures, #find_scenarios, #procedure

Methods included from ForemanMaintain::Concerns::Logger

#logger

Methods inherited from Base

#available_checks, #available_procedures, available_tags, #available_tags, completion_map, completion_types, dashize, #dashize, delete_duplicate_assumeyes_if_any, interactive_option, label_option, #label_string, option, #option_wrapper, parameter, #print_check_info, #reporter, #run_scenario, #run_scenarios_and_exit, service_options, subcommand, #tag_string, tags_option, #underscorize

Instance Method Details

#executeObject



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/foreman_maintain/cli/advanced/prebuild_bash_completion.rb', line 7

def execute
  comp_map = ForemanMaintain::Cli::MainCommand.completion_map
  answers = feature(:installer).configuration[:answer_file]
  comp_map[:expire] = {
    :file => answers,
    :sha1sum => execute!("sha1sum #{answers}")
  }
  cache_dir = File.dirname(ForemanMaintain.config.completion_cache_file)
  FileUtils.mkdir_p(cache_dir) unless File.directory?(cache_dir)
  File.write(ForemanMaintain.config.completion_cache_file, comp_map.to_yaml)
end