-
Notifications
You must be signed in to change notification settings - Fork 897
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
Rails scripts for setting a server's zone and configuration settings from a command line #11204
Conversation
53b8442
to
46279c7
Compare
tools/configure_server_settings.rb
Outdated
@@ -0,0 +1,37 @@ | |||
if ARGV.empty? | |||
puts "USAGE: #{__FILE__} server_id settings_path_separated_by_a_/ value [settings_path_separated_by_a_/ value]" |
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 don't understand this. Can we provide an example?
- We should probably require config/environment so it can be run with straight ruby.
require File.expand_path("../config/environment", __dir__)
- Can we add a shebang at the top and
chmod +x
these scripts?
#!/usr/bin/env ruby
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 wonder if it makes sense to have a --dry-run
option to report the server id, name, and existing value but don't make any changes. Maybe for a followup PR.
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 wonder if it would be easier if settings_path_separated_by_a_/ value
was split up into -p
and -v
for a path and value.
@gtanzillo let me know what you think of those suggestions above... |
@jrafanie Thanks for all the great feedback. I'm working on making the suggested changes and will update the PR when done. |
@gtanzillo @jrafanie bump |
…from a command line tools/configure_server_zone.rb - Updates the zone of a specific server. The zone must exist. tools/configure_server_settings.rb - Generic script updating VMDB configuration settings of a specific server.
Renamed zone script. Added usage example to settings script.
@jrafanie I made all of the changes you recommended. Please have another look. Thanks! |
"Example: #{__FILE__} -d -s 1 -p reporting/history/keep_reports -v 42" | ||
|
||
opt :dry_run, "Dry Run", :short => "d" | ||
opt :serverid, "Server Id", :short => "s", :default => 0 |
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.
Nitpicky but we call it server_id
in the prior script in the USAGE
line, we should do that here too.
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.
@jrafanie I decided to change it to serverid in the other script, instead.
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.
@gtanzillo I only had a very minor nitpicky consistency comment. Fix that and we can
@jrafanie This should be good to go. Thanks. |
Checked commits gtanzillo/manageiq@1939a1a~...a116a75 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 |
These tools enable automation of server configuration in environments that have many appliances