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

PR 44366 #48182

Merged
merged 3 commits into from Jun 19, 2018
Merged

PR 44366 #48182

merged 3 commits into from Jun 19, 2018

Conversation

ghost
Copy link

@ghost ghost commented Jun 18, 2018

What does this PR do?

Allows Salt Cloud to operate within a separate directory tree without having to define the configuration directive log_file separately (on the command line or in the main cloud configuration file).

What issues does this PR fix or reference?

#44366

Previous Behavior

A user has to specify --log-file separately, even if root_dir is specified in the main cloud configuration file and -c is being used on the command line.

New Behavior

Running SaltCloud with non-default configuration file locations works as expected ie. the log file ends up under the directory hierarchy specified in 'root_dir' directive in the main salt cloud configuration file.

Tests written?

No

Commits signed with GPG?

No

@ghost ghost self-requested a review as a code owner June 18, 2018 12:58
@ghost ghost self-requested a review June 18, 2018 12:58
@@ -2787,7 +2787,7 @@ def cloud_config(path, env_var='SALT_CLOUD_CONFIG', defaults=None,
apply_sdb(opts)

# prepend root_dir
prepend_root_dirs = ['cachedir']
prepend_root_dirs = ['cachedir','log_file']
prepend_root_dir(opts, prepend_root_dirs)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@samilaine but can we maybe not to call this list "prepend_root_dirs", since it is path options? I understand that the variable was already there, but let's agree it is greatly misleading name. Maybe I would just do it so:

prepend_root_dir(opts, ['cachedir','log_file'])

So whoever wants to know how this is working, can lookup the function and see that this is just a path_options.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However, it turns out that there might be a reasonable explanation for that funny variable prepend_root_dirs (see line 2358 in salt/config/__init__.py) .

So, instead of getting rid of the funny variable, I opted for abusing it even more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for the record, i am for leaving the variable, as it is how all the other config functions work, master_config, minion_config, etc.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@samilaine 😉 Well, OK. I approved this anyway, and that one was up to you. Thanks!

@rallytime rallytime merged commit 1d6ab95 into saltstack:develop Jun 19, 2018
@ghost ghost deleted the fix-cloud-config-root-dir branch June 25, 2018 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants