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

Fix providing relative paths to the config file #1241

Merged
merged 1 commit into from
Sep 14, 2018
Merged

Fix providing relative paths to the config file #1241

merged 1 commit into from
Sep 14, 2018

Conversation

tas50
Copy link
Contributor

@tas50 tas50 commented Sep 9, 2018

We do an expand_path on the passed config value and we use Dir.pwd with the expand, but before we ever get here we change the directory to /, which means specifying a file in the working directory results in something like /client.rb. This isn't what the user wants. Instead change the working directory right before we run the application instead of before we work out the config situation.

Signed-off-by: Tim Smith tsmith@chef.io

@tas50 tas50 requested a review from a team September 9, 2018 04:00
We do an expand_path on the passed config value and we use Dir.pwd with the expand, but before we ever get here we change the directory to /, which means specifying a file in the working directory results in something like /client.rb. This isn't what the user wants. Instead change the working directory right before we run the application instead of before we work out the config situation.

Signed-off-by: Tim Smith <tsmith@chef.io>
@tas50
Copy link
Contributor Author

tas50 commented Sep 9, 2018

I'm really not actually sure if we need this chdir anymore at all. I created a non-priv'd user on my Mac and ran ohai using that user from the home directory of my personal user without issue. The original reason we added this chdir was to get around errors running ohai from within a directory we didn't have privs on. https://tickets.opscode.com/browse/OHAI-174

@lamont-granquist
Copy link
Contributor

yeah that old ohai ticket is crazyballs.

this line of code ultimately needs to get removed.

callers should be responsible for doing cd / themselves. this is caused by the old chef-solr cli which used to drop privs and apparently run ohai for some reason. it should have been made responsible for chdir /'ing itself. similarly any init scripts that run chef-client/ohai need to be responsible for doing that themselves.

@tas50
Copy link
Contributor Author

tas50 commented Sep 10, 2018

I created #1246 to track removing the chdir altogether.

@tas50 tas50 merged commit 1816d79 into master Sep 14, 2018
@chef-ci chef-ci deleted the fix_config branch September 14, 2018 17:47
@lock
Copy link

lock bot commented Jan 24, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants