-
Notifications
You must be signed in to change notification settings - Fork 33
Fixes #21220 - make k-c-h command name easily changed #552
Conversation
Issues: #21220 |
ab65102
to
5cb82b9
Compare
katello/katello-change-hostname
Outdated
proxy: "Foreman Proxy", | ||
plural_proxy: "Foreman Proxies", | ||
proxy_hyphenated: "foreman-proxy-content", | ||
plugin: "katello" |
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 might prefer this being command
or command_name
rather than plugin. Plugin tends to evoke a lot of other thoughts and this isn't really a plugin system.
@ehelms updated to |
cafb928
to
a011f3e
Compare
katello/hostname-change.rb
Outdated
@options[:program] = program || @default_program | ||
@options[:scenario] = scenario || @last_scenario | ||
@options[:program] = init_options[:program] || @default_program | ||
@options[:scenario] = init_options[:scenario] || @last_scenario |
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.
Hashes have a builtin function for this .fetch(:scenario, @last_scenario)
katello/hostname-change.rb
Outdated
@plural_proxy = init_options[:plural_proxy] | ||
@proxy_hyphenated = init_options[:proxy_hyphenated] | ||
@accepted_scenarios = init_options[:accepted_scenarios] | ||
@command_prefix = init_options[:command_prefix] |
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.
If these are all required, you can use fetch
to enforce that.
a011f3e
to
2b74dc3
Compare
@ehelms thanks, updated |
katello/hostname-change.rb
Outdated
@options[:program] = program || @default_program | ||
@options[:scenario] = scenario || @last_scenario | ||
@options[:program] = init_options[:program].fetch(:program, @default_program) | ||
@options[:scenario] = init_options[:scenario].fetch(:scenario, @last_scenario) |
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 you mean to leave off the [:...] for these two options?
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.
updated
2b74dc3
to
cbc0014
Compare
katello/hostname-change.rb
Outdated
@command_prefix = init_options.fetch(:command_prefix) | ||
# accepted_scenarios is not a required parameter, so we allow to return nil. | ||
# See method in helper file | ||
@accepted_scenarios = init_options[:accepted_scenarios] |
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.
You can make this explicit without the need for comment by using init_options.fetch(:accepted_scenarios, nil)
which will set the default to nil.
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.
thanks, updated
cbc0014
to
379c032
Compare
We need this to backport these changes.
379c032
to
b9353c3
Compare
We need this to backport these changes.