Bash¶
TEMPLATEbash_package_install¶Install a package
Uses the right command based on pkg_manager property defined in product.yml.
- Parameters
package (str) – name of the package
bash_package_install(package)
TEMPLATEbash_package_remove¶Remove a package
Uses the right command based on pkg_manager property defined in product.yml.
- Parameters
package (str) – name of the package
bash_package_remove(package)
TEMPLATEbash_dconf_settings¶# Macro to configure DConf settings for RHEL and Fedora systems.
bash_dconf_settings(path, key, value, db, setting_file)
TEMPLATEbash_dconf_lock¶# Macro to configure DConf locks for RHEL and Fedora systems.
bash_dconf_lock(key, setting, db, lock_file)
TEMPLATEbash_service_command¶# Macro to enable or disable a particular service. # # Examples: # # bash_service_command(“enable”, “bluetooth”) # bash_service_command(“disable”, “bluetooth.service”) # bash_service_command(“disable”, “rsh.socket”, xinetd=”rsh”)
bash_service_command(service_state, service, xinetd=”“)
TEMPLATEbash_firefox_js_setting¶# bash_firefox_js_setting expects three arguments: # # config_file: Configuration file that will be modified # key: Configuration option to change # value: Value of the configuration option to change # # Example Calls: # # With a fixed integer value: # bash_firefox_js_setting(“local-settings.js”, “general.config.obscure_value”, “0”) # # With a fixed string value: # bash_firefox_js_setting(“local-settings.js”, “general.config.filename”, quoted_value=”mozilla.cfg”) # # With a string variable: # bash_firefox_js_setting(“local-settings.js”, “general.config.filename”, quoted_value=”$var_config_file_name”)
bash_firefox_js_setting(config_file, key, value=”“, quoted_value=”“, sed_separator=”/”)
TEMPLATEbash_firefox_cfg_setting¶# Function to replace configuration setting(s) in the Firefox preferences configuration (.cfg) file or add the # preference if it does not exist. # # Expects three arguments: # # config_file: Configuration file that will be modified # key: Configuration option to change # value: Value of the configuration option to change # # # Example Call(s): # # Without string or variable: # bash_firefox_cfg_setting(“mozilla.cfg” “extensions.update.enabled” value=”false”) # # With string: # bash_firefox_cfg_setting(“mozilla.cfg” “security.default_personal_cert” quoted_value=”Ask Every Time”) # # With a string variable: # bash_firefox_cfg_setting(“mozilla.cfg” “browser.startup.homepage” quoted_value=”${var_default_home_page}”)
bash_firefox_cfg_setting(config_file, key, value=”“, quoted_value=”“, sed_separator=”/”)
TEMPLATEbash_ensure_there_are_servers_in_ntp_compatible_config_file¶# Macro to ensure that the ntp/chrony config file contains valid server entries. # config_file: Path to the ntp/chrony config file # servers_list: Comma-separated list of servers
bash_ensure_there_are_servers_in_ntp_compatible_config_file(config_file, servers_list)
TEMPLATEbash_set_faillock_option¶# Sets PAM faillock module options and values. # Also it adds pam_faillock.so as required module for account. # option: faillock option eg. deny, unlock_time # value: value of option
bash_set_faillock_option(option, value)
TEMPLATEset_config_file¶# Add an entry to a text configuration file # path: path of the configuration file # parameter: the paramenter to be set in the configuration file # value: the value of the parameter to be set in the configuration file # create: whether create the file specified by path if the file does not exits # insert_after: inserts the entry right after first line that matches regular expression specified by this argument, set to EOF to insert at the end of the file # insert_before: inserts the entry right before first line that matches regular expression specified by this argument, set to BOF to insert at the beginning of the file # insensitive: ignore case # separator: separates parameter from the value (literal) # separator_regex: regular expression that describes the separator and surrounding whitespace # prefix_regex: regular expression describing allowed leading characters at each line
set_config_file(path, parameter, value, create, insert_after, insert_before, insensitive=true, separator=” “, separator_regex=”s+”, prefix_regex=”^s*”)
TEMPLATEbash_file_contents¶Generates bash script code that puts ‘contents’ into a file at ‘filepath’ Parameters:
filepath - filepath of the file to check
contents - contents that should be in the file
bash_file_contents(filepath=’‘, contents=’‘)