-
Notifications
You must be signed in to change notification settings - Fork 900
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
Update fix_auth verbiage #23382
Update fix_auth verbiage #23382
Conversation
tools/fix_auth/auth_model.rb
Outdated
@@ -127,9 +127,8 @@ def run(options = {}) | |||
puts "processed #{processed} with #{errors} errors" | |||
end | |||
end | |||
puts "#{options[:dry_run] ? "viewed" : "processed"} #{processed} records" unless options[:silent] | |||
puts "#{options[:dry_run] ? "will change" : "changed"} #{records_changed} of #{processed} records" unless options[:silent] |
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.
My brain melts with the embedded double quotes within the interpolated strings. Can you use single quotes instead?
The unless
is easy to miss. I know it's how it was previously so it can be changed as a followup but maybe something like this would be easier for me to grok:
unless options[:silent]
puts "#{options[:dry_run] ? 'will change' : 'changed'} #{records_changed} of #{processed} records"
end
changed 5 of 10 records
will change 5 of 10 records
Maybe "would change" would be better?
Should we flip the order:
5 of 10 records changed
5 of 10 records would change (dry run enabled)
tools/fix_auth/fix_auth.rb
Outdated
@@ -67,6 +67,9 @@ def fix_database_passwords | |||
ActiveRecord::Base.logger = Logger.new("#{options[:root]}/log/fix_auth.log") | |||
ActiveRecord::Base.establish_connection(db_attributes(database)) | |||
end | |||
|
|||
puts "database: #{options[:database]}" |
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.
Does this get lost when the remaining messages are written to the screen from the different models?
Can you post a sample of what it looks like now?
Thanks!
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.
Yeah I think it at least needs a verb...something like
puts "database: #{options[:database]}" | |
puts "Processing database: #{options[:database]}" |
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 did try changing all of these to upper case, but it was harder for me to read for some reason.
I'll add "processing" and see if that helps.
Will also update the usage up top.
update the usage statement to make database name more clear
- Display the Database I think most users expect it to change the one specified in database.yml We will have to change this one day. Until then, it is now displaying it - Message around the number of records actually changed. We see processed, but it is not clear if anything actually happened. This is fixed
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.
LGTM
update:
update:
|
Changes look good. I'm trying it locally. |
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.
LGTM
% ./tools/fix_auth.rb vmdb_demo_env_03132025 -h localhost -x -i smartvm -v
** override_gem("byebug", :require=>"byebug") at /Users/joerafaniello/.bundler.d/byebug.rb:1
processing database: vmdb_demo_env_03132025
fixing authentications.password, auth_key
3:
password: "v2:{.../aE}" => v2:{...Q==} HARDCODED (WAS INVALID)
2:
password: "v2:{...g==}" => v2:{....Q==} HARDCODED (WAS INVALID)
17:
password: "v2:{...A==}" => v2:{.Q==} HARDCODED (WAS INVALID)
18:
auth_key: "v2:{...B6v}" => v2:{...Q==} HARDCODED (WAS INVALID)
24:
password: "v2:{...w==}" => v2:{...Q==} HARDCODED (WAS INVALID)
28:
password: "v2:{...w==}" => v2:{...Q==} HARDCODED (WAS INVALID)
29:
auth_key: "v2:{...g==}" => v2:{...Q==} HARDCODED (WAS INVALID)
40:
auth_key: "v2:{...g==}" => v2:{...Q==} HARDCODED (WAS INVALID)
8 of 8 records changed
fixing configuration_scripts.credentials
0 of 0 records changed
fixing miq_databases.session_secret_token, csrf_secret_token
1:
session_secret_token: "v2:{...4d6}" => v2:{...H/VH}
csrf_secret_token: "v2:{...QuP}" => v2:{...gWw}
1 of 1 records changed
fixing miq_ae_values.value
0 of 0 records changed
fixing miq_ae_fields.default_value
0 of 0 records changed
fixing settings_changes.value
24:
value: "v2:{...g==}" => v2:{...Q==} HARDCODED (WAS INVALID)
1 of 1 records changed
fixing miq_requests.options
0 of 0 records changed
fixing miq_request_tasks.options
0 of 0 records changed
Nice work @kbrock, thanks! |
Display the Database
I think most users expect it to change the one specified in database.yml We will have to change this one day. Until then, it is now displaying it
Message around the number of records actually changed.
We see processed, but it is not clear if anything actually happened. This is fixed
Update usage
Usage has removed
[...]
since we no longer handle multiple databases and it was distracting. Removedruby
since it is no longer required.New Output
(couldn't figure out how to auto print the usage