Added home discovery to arcgis-enterprise esri_properties#409
Open
romanZupancic wants to merge 1 commit intoEsri:mainfrom
Open
Added home discovery to arcgis-enterprise esri_properties#409romanZupancic wants to merge 1 commit intoEsri:mainfrom
romanZupancic wants to merge 1 commit intoEsri:mainfrom
Conversation
Replaced current home path substitution with new shellout command to
dynamically discover a users home directory
- Before, the `esri_properties` module would assume the installing
user's home directory was located under `/home/username`
- Now, `esri_properties` will discover the home directory via
`getent passwd \"#{user}\" | cut -d: -f6 | awk '{printf $0}'`
This will accomodate use-cases where the installing user's home
directory is not under `/home`.
Contributor
|
It the typical use cases the run as user account is created and configured by Chef with a specific home directory (see https://github.com/Esri/arcgis-cookbook/blob/main/cookbooks/arcgis-enterprise/recipes/system.rb#L50). To work around the problem addressed by this PR, I suggest we introduce a new attribute for run_as_user home directory: default['arcgis']['run_as_home'] = '/home/' + node['arcgis']['run_as_user']And use this attribute here) and there instead of assuming If a non-standard home directory is used, it must be specified by the arcgis.run_as_home Chef attribute. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The problem
We're installing ArcGIS enterprise with a user in a non-standard home directory (in our case,
/arcgisinstead of/home/arcgis) and encountered a problem with multiple converges: ArcGIS Portal and Server attempt to reinstall on the second converge.Specifically, the ArcGIS Portal and Server installers are crashing on the second converge (because their products are already installed). They shouldn't even be running in the first place!
What is happening
arcgis_enterprise_portal 'Install Portal for ArcGIS'is executing on the second converge, even though Portal for ArcGIS is already installed (this resource is declared here)The resources which install Portal and Server have
not_ifguards on them. These guards are dependent on theesri_propertiesmodule (https://github.com/Esri/arcgis-cookbook/blob/main/cookbooks/arcgis-enterprise/libraries/esri_properties.rb).That module should:
Right now, it does Step 1 under the assumption that the user's home folder is under
/homeand has the same name as the user:What this commit changes
Replaced current home path substitution with new shellout command to dynamically discover a users home directory
esri_propertiesmodule would assume the installing user's home directory was located under/home/usernameesri_propertieswill discover the home directory viagetent passwd \"#{user}\" | cut -d: -f6 | awk '{printf $0}'getend passwd \"#{user}\"actually returns a passwd line for the usercut -d: -f6extracts the home directory`awk '{printf $0}'removes the newlineEffectively, the esri_properties.rb now contains:
This will accommodate use-cases where the installing user's home directory is not under
/home.