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
Rely on env variable for manageiq-appliance repo directory #4105
Conversation
@simaishi @carbonin @Fryguy please review. @roliveri @jerryk55 @movitto @hsong-rh Note, if you clone your manage-appliance repo somewhere else on your dev/appliance setup, you'll need to set your APPLIANCE_REPO_DIRECTORY environment variable here when these related PRs are merged. manageiq repo knew too much about where other repos lived and what they contained. |
I can't imagine that we will re-arrange our directory structure more than once or twice over the next few years. If this is a cross repo concern, then we have 2 choices:
|
@jrafanie @abellotti @kbrock This PR makes it seem that maybe it is time to extract appliance_console into its own repo? |
Good point @kbrock, it doesn't really belong in ManageIQ, maybe you or @abellotti have some ideas if the manageiq code from appliance_console really needs to do this work in the first place. It's really, if you've configured This is probably outside the scope of this PR. |
I think you would also need to change https://github.com/ManageIQ/manageiq/blob/master/gems/pending/appliance_console/external_httpd_authentication.rb#L115 . |
Good catch, I'll fix that. |
Use the APPLIANCE_TEMPLATE_DIRECTORY environment variable provided by: ManageIQ/manageiq-appliance#12
af844ef
to
ec7b5e9
Compare
I see them defined in the other PR, but wouldn't hurt to have code early on in appliance_console to check these ENV variables are indeed defined and bail out, just in case. Otherwise, we'll get stack traces or worse. |
Checked commits jrafanie/manageiq@1bea799~...ec7b5e9 with rubocop 0.33.0 and haml-lint 0.13.0 |
Can we pull the |
@kbrock Can you clarify which code you want to extract into appliance console? |
@abellotti I don't know, we've never had checks for APPLIANCE and RAILS_ENV env variables which are used all over the place and are also set in similar places in manageiq-appliance repo. If we've had any problems with them, we'd be using the wrong Rails env or installing development gems on appliances. Any issues we get now might be temporary until these env variables stabilize or any of my bugs are fixed. When we tag upstream, the different repos will have to be tagged together to work together. If I'm running on an appliance and get a I also added a |
@kbrock @chessbyte Feel free to open an issue to extract |
@jrafanie @chessbyte I was thinking something like #4212 I like the idea of keeping the appliance code separate from the rails code. never thought of the I've always viewed tasks like database create / backup / restore / set region / database.yml creation and tasks that would basically create or destroy a rails app to be the job of the appliance (and appliance console). But I'm curious where others draw that line. Case and point: I also consider the job of starting and stopping the rails apps / workers to be outside the role of the rails app as well. And we clearly have that inside the rails app. |
@@ -15,7 +15,7 @@ def self.postgres_dir | |||
end | |||
|
|||
def self.postgresql_template | |||
RAILS_ROOT.join("../system/TEMPLATE").join(postgres_dir) | |||
PostgresAdmin.template_directory.join(postgres_dir) |
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.
Is this right? I feel like this should just be template_directory directly?
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.
It's pretty complicated but the TEMPLATE directory has stuff laid out as they get applied to /, like a chroot. So, we need to the root of the TEMPLATE directory and the normal PG_DATA directory (postgres_dir) in this case.
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.
Right, but why does PostgresAdmin know about template_directory? Seems like that class should not care about that.
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.
Agreed that it is too bad we have to rely upon template directory, but lets not revisit at this time.
Ok, so is the request to move PostgresAdmin.template_directory
to InternalDatabaseConfiguration
?
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, it's "weird" that PostgresAdmin knows that the templates for postgresql are stored there.
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.
It feels like we need a generic template directory on a more generic module/class that these other places can call.
Rely on env variable for manageiq-appliance repo directory
ManageIQ code shouldn't know where the old system/TEMPLATE is
Use the APPLIANCE_TEMPLATE_DIRECTORY environment variable provided by manageiq-appliance PR below.
Related PRs: