Skip to content
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

Merged
merged 3 commits into from
Jun 13, 2017

Conversation

gtanzillo
Copy link
Member

These tools enable automation of server configuration in environments that have many appliances

  • 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.

@@ -0,0 +1,37 @@
if ARGV.empty?
puts "USAGE: #{__FILE__} server_id settings_path_separated_by_a_/ value [settings_path_separated_by_a_/ value]"
Copy link
Member

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

Copy link
Member

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.

Copy link
Member

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.

@jrafanie
Copy link
Member

@gtanzillo let me know what you think of those suggestions above...

@gtanzillo
Copy link
Member Author

@jrafanie Thanks for all the great feedback. I'm working on making the suggested changes and will update the PR when done.

@chessbyte
Copy link
Member

@gtanzillo @jrafanie bump

gtanzillo added 2 commits June 2, 2017 16:45
…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.
@gtanzillo
Copy link
Member Author

@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
Copy link
Member

@jrafanie jrafanie Jun 5, 2017

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.

Copy link
Member Author

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.

Copy link
Member

@jrafanie jrafanie left a 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 :shipit:

@gtanzillo
Copy link
Member Author

@jrafanie This should be good to go. Thanks.

@miq-bot
Copy link
Member

miq-bot commented Jun 13, 2017

Checked commits gtanzillo/manageiq@1939a1a~...a116a75 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
2 files checked, 0 offenses detected
Everything looks fine. 🍰

@jrafanie jrafanie merged commit 9e39485 into ManageIQ:master Jun 13, 2017
@jrafanie jrafanie added this to the Sprint 63 Ending Jun 19, 2017 milestone Jun 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants