-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement puppet-metadata with various subcommands #120
base: master
Are you sure you want to change the base?
Conversation
d633196
to
f1b04bb
Compare
This implements a puppet-metadata executable which now only implements the eol command to show which operating systems in metadata are end of life.
f1b04bb
to
ab4cffe
Compare
end | ||
|
||
def self.commands | ||
subclasses.to_h { |subclass| [subclass.command, subclass] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
subclasses is an undefined variable:
$ bundle exec puppet-metadata
bundler: failed to load command: puppet-metadata (/home/bastelfreak/code/puppet_metadata/.vendor/ruby/3.0.0/bin/puppet-metadata)
/home/bastelfreak/code/puppet_metadata/bin/puppet-metadata:23:in `commands': undefined local variable or method `subclasses' for BaseCommand:Class (NameError)
Did you mean? superclass
from /home/bastelfreak/code/puppet_metadata/bin/puppet-metadata:59:in `main'
from /home/bastelfreak/code/puppet_metadata/bin/puppet-metadata:68:in `<top (required)>'
from /home/bastelfreak/code/puppet_metadata/.vendor/ruby/3.0.0/bin/puppet-metadata:25:in `load'
from /home/bastelfreak/code/puppet_metadata/.vendor/ruby/3.0.0/bin/puppet-metadata:25:in `<top (required)>'
from /home/bastelfreak/code/puppet_metadata/.vendor/ruby/3.0.0/gems/bundler-2.4.1/lib/bundler/cli/exec.rb:58:in `load'
from /home/bastelfreak/code/puppet_metadata/.vendor/ruby/3.0.0/gems/bundler-2.4.1/lib/bundler/cli/exec.rb:58:in `kernel_load'
from /home/bastelfreak/code/puppet_metadata/.vendor/ruby/3.0.0/gems/bundler-2.4.1/lib/bundler/cli/exec.rb:23:in `run'
from /home/bastelfreak/code/puppet_metadata/.vendor/ruby/3.0.0/gems/bundler-2.4.1/lib/bundler/cli.rb:491:in `exec'
from /home/bastelfreak/code/puppet_metadata/.vendor/ruby/3.0.0/gems/bundler-2.4.1/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
from /home/bastelfreak/code/puppet_metadata/.vendor/ruby/3.0.0/gems/bundler-2.4.1/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
from /home/bastelfreak/code/puppet_metadata/.vendor/ruby/3.0.0/gems/bundler-2.4.1/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
from /home/bastelfreak/code/puppet_metadata/.vendor/ruby/3.0.0/gems/bundler-2.4.1/lib/bundler/cli.rb:34:in `dispatch'
from /home/bastelfreak/code/puppet_metadata/.vendor/ruby/3.0.0/gems/bundler-2.4.1/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
from /home/bastelfreak/code/puppet_metadata/.vendor/ruby/3.0.0/gems/bundler-2.4.1/lib/bundler/cli.rb:28:in `start'
from /home/bastelfreak/code/puppet_metadata/.vendor/ruby/3.0.0/gems/bundler-2.4.1/exe/bundle:45:in `block in <top (required)>'
from /home/bastelfreak/code/puppet_metadata/.vendor/ruby/3.0.0/gems/bundler-2.4.1/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
from /home/bastelfreak/code/puppet_metadata/.vendor/ruby/3.0.0/gems/bundler-2.4.1/exe/bundle:33:in `<top (required)>'
from /usr/bin/bundle:25:in `load'
from /usr/bin/bundle:25:in `<main>'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I read somewhere that subclasses
was a newer Ruby feature. I guess that isn't in 3.0 yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested around and it works with Ruby 3.1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll figure out if there's a nice solution. I'd like to avoid making part of the codebase Ruby 3.1+ but the rest 2.7+.
PuppetMetadata.read(@filename) | ||
end | ||
rescue StandardError => e | ||
warn "Failed to read #{filename}: #{e}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warn "Failed to read #{filename}: #{e}" | |
warn "Failed to read #{@filename}: #{e}" |
This implements a puppet-metadata executable which now only implements the eol command to show which operating systems in metadata are end of life.