-
Notifications
You must be signed in to change notification settings - Fork 100
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
Allow setting MIQ admin password during deployment #250
Conversation
- Added admin-password element to existing secrets object - Added parameter for APPLICATION_ADMIN_PASSWORD - Added shell function to set password via rails runner
templates/miq-template.yaml
Outdated
required: true | ||
description: Admin password that will be set on the application. | ||
from: "[a-zA-Z0-9]{8}" | ||
generate: expression |
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 feel like we should keep the default value here rather than using a generator.
If someone wants to change the password on deploy they can set the parameter, otherwise I think we should just keep "smartvm"
function set_admin_pwd() { | ||
echo "== Setting admin password ==" | ||
|
||
cd ${APP_ROOT} && bin/rails runner -e production "EvmDatabase.seed_primordial; user = User.find_by_userid('admin'); user.password = ENV['APPLICATION_ADMIN_PASSWORD']; user.save; exit;" |
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 we can simplify the ruby here.
EvmDatabase.seed_primordial; User.find_by_userid('admin').update_attributes!(:password => ENV['APPLICATION_ADMIN_PASSWORD'])
@bdunne this look good to you?
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.
Also, I think RAILS_ENV=production
is exported in /etc/default/evm
so we shouldn't need the -e production
here.
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.
@carbonin Yep , will go ahead and test with the simplied version. /etc/default/evm
is already sourced so should work without -e.
@fbladilo will you have time to respond to the comments in this PR? |
@@ -34,6 +34,9 @@ case $? in | |||
|
|||
# Restore symlinks from PV to application rootdir | |||
restore_pv_data | |||
|
|||
# Set admin pwd |
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.
This comment hardly seems necessary.
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.
@chessbyte Surely , already commented and working on requested changes..
- Removed unnecessary comments - Switched from auto-gen to default pwd on templates
Checked commits fbladilo/manageiq-pods@2952bd8~...896e0b7 with ruby 2.3.3, rubocop 0.47.1, haml-lint 0.20.0, and yamllint 1.10.0 **
|
Allow setting MIQ admin password during deployment (cherry picked from commit 941a134)
Gaprindashvili backport details:
|
Usage :
oc new-app --template=manageiq -p APPLICATION_ADMIN_PASSWORD=mypasswd
@carbonin @bdunne