Class: Abide::CLI::SceUpdateConfigFromDiff
- Inherits:
-
AbideCommand
- Object
- CmdParse::Command
- AbideCommand
- Abide::CLI::SceUpdateConfigFromDiff
- Defined in:
- lib/abide_dev_utils/cli/sce.rb
Constant Summary collapse
- CMD_NAME =
'from-diff'
- CMD_SHORT =
'Update by diffing two XCCDF files'
- CMD_LONG =
'Update by diffing two XCCDF files'
- CMD_CONFIG_FILE =
'Path to the Puppet SCE config file'
- CMD_CURRENT_XCCDF =
'Path to the current XCCDF file'
- CMD_NEW_XCCDF =
'Path to the new XCCDF file'
Constants included from AbideDevUtils::Config
AbideDevUtils::Config::DEFAULT_PATH
Instance Method Summary collapse
- #execute(_config_file, _cur_xccdf, _new_xccdf) ⇒ Object
- #help_arguments ⇒ Object
-
#initialize ⇒ SceUpdateConfigFromDiff
constructor
A new instance of SceUpdateConfigFromDiff.
Methods inherited from AbideCommand
Methods included from AbideDevUtils::Config
config_section, #config_section, fetch, #fetch, #to_h, to_h
Constructor Details
#initialize ⇒ SceUpdateConfigFromDiff
Returns a new instance of SceUpdateConfigFromDiff.
176 177 178 179 180 181 182 183 184 185 186 187 188 |
# File 'lib/abide_dev_utils/cli/sce.rb', line 176 def initialize super(CMD_NAME, CMD_SHORT, CMD_LONG, takes_commands: false) argument_desc(CONFIG_FILE: CMD_CONFIG_FILE, CURRENT_XCCDF: CMD_CURRENT_XCCDF, NEW_XCCDF: CMD_NEW_XCCDF) .on('-o [FILE]', '--out-file [FILE]', 'Path to save the updated config file') do |o| @data[:out_file] = o end .on('-v', '--verbose', 'Verbose output') do @data[:verbose] = true end .on('-q', '--quiet', 'Quiet output') do @data[:quiet] = true end end |
Instance Method Details
#execute(_config_file, _cur_xccdf, _new_xccdf) ⇒ Object
199 200 201 202 203 204 205 206 207 208 |
# File 'lib/abide_dev_utils/cli/sce.rb', line 199 def execute(_config_file, _cur_xccdf, _new_xccdf) warn 'This command is currently non-functional' # AbideDevUtils::Validate.file(config_file, extension: 'yaml') # AbideDevUtils::Validate.file(cur_xccdf, extension: 'xml') # config_hiera = AbideDevUtils::Files::Reader.read(config_file, safe: true) # diff = AbideDevUtils::XCCDF::Diff::BenchmarkDiff.new(cur_xccdf, new_xccdf).diff[:diff][:number_title] # new_config_hiera, change_report = AbideDevUtils::Sce.update_legacy_config_from_diff(config_hiera, diff) # AbideDevUtils::Output.yaml(new_config_hiera, console: @data[:verbose], file: @data[:out_file]) # AbideDevUtils::Output.simple(change_report) unless @data[:quiet] end |
#help_arguments ⇒ Object
190 191 192 193 194 195 196 197 |
# File 'lib/abide_dev_utils/cli/sce.rb', line 190 def help_arguments <<~ARGHELP Arguments: CONFIG_FILE: #{CMD_CONFIG_FILE} CURRENT_XCCDF: #{CMD_CURRENT_XCCDF} NEW_XCCDF: #{CMD_NEW_XCCDF} ARGHELP end |