Class: OsVersionsCommand
- Inherits:
-
PuppetMetadata::BaseCommand
- Object
- PuppetMetadata::BaseCommand
- OsVersionsCommand
- Defined in:
- lib/puppet_metadata/command/os_versions.rb
Overview
Manage operating system versions in metadata.json
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from PuppetMetadata::BaseCommand
command, commands, #filename, #initialize, #metadata
Constructor Details
This class inherits a constructor from PuppetMetadata::BaseCommand
Class Method Details
.parser(options) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/puppet_metadata/command/os_versions.rb', line 5 def self.parser() OptionParser.new do |opts| opts.set_program_name 'Manage operating system versions in metadata.json' opts.on('--at DATE', Date, 'The date to use for EOL checks') do |value| [:at] = value end opts.on('--os OPERATINGSYSTEM', 'Only process the specific operating system') do |value| [:os] = value end opts.on('--add-missing', 'Add missing supported OS versions to metadata.json') do [:add_missing] = true end opts.on('--remove-eol', 'Remove EOL OS versions from metadata.json') do [:remove_eol] = true end opts.on('--noop', 'Show what would be changed without modifying metadata.json') do [:noop] = true end end end |
Instance Method Details
#run ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/puppet_metadata/command/os_versions.rb', line 26 def run changes_made = false if @options[:add_missing] && @options[:remove_eol] # Run both operations in sequence changes_made |= add_missing changes_made |= remove_eol elsif @options[:add_missing] changes_made = add_missing elsif @options[:remove_eol] changes_made = remove_eol else list_versions return end PuppetMetadata.write(filename, ) if changes_made && !@options[:noop] end |