Skip to content

Follow up to PR #38527 - #38585

Merged
cachedout merged 7 commits into
saltstack:2016.3from
rallytime:follow-up-38527
Jan 17, 2017
Merged

cachedout merged 7 commits into
saltstack:2016.3from
rallytime:follow-up-38527

Conversation

@rallytime

@rallytime rallytime commented Jan 5, 2017 •

Copy link
Copy Markdown
Contributor

What does this PR do?

This PR back-ports the changes made by @rbjorklin in #38527 to the 2016.3 branch and also adds back in the log_file and pidfilevalue settings.

This ensures that if rest_timeout values are set in the master config file, the value defined in the DEFAULT_API_OPTS will not overwrite the value defined in the master config file. (This will also be the case for any additions API default opts that get added to config/__init__.py down the line.)

This change also ensures that that the log_file and pidfile values are overwritten by the values specified by api_logfile and api_pidfile, respectively, either explicitly by the user in the master config file or by the values defined by DEFAULT_API_OPTS.

I would like to write a test case for this as well, but I wanted to get some feedback on this approach first.

This approach should be covering both the rest_timeout setting bug as well as the log_file bugs that have been filed recently against this area of the code. The relevant PRs and bug reports are linked below. A more detailed discussion of this change is in #38527.

I would love it if @whiteinge could review this change as well.

What issues does this PR fix or reference?

PRs:

Issues:

@rallytime
rallytime requested a review from whiteinge January 5, 2017 15:41
@rallytime rallytime added the pending-discussion The issue or pull request needs more discussion before it can be closed or merged label Jan 5, 2017
Comment thread salt/config/__init__.py
# Let's set the pidfile and log_file values in opts to api settings
opts.update({
'pidfile': opts.get('api_pidfile', DEFAULT_API_OPTS['api_pidfile']),
'log_file': opts.get('api_logfile', DEFAULT_API_OPTS['api_logfile']),

@whiteinge whiteinge Jan 6, 2017 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I looked through the history for this file and I do not understand the purpose of setting pidfile and log_file to the corresponding api_* values at all. Shot in the dark: I wonder if the daemon that manages netapi modules is expecting those values and should be switched to look for the api_* variants. Edit: Or maybe the way we're doing the settings mixins means these value names are set in stone?

That said, in order to correctly work with a non-default root_dir setting both those values would also need to be added to the prepend_root_dir call below.

I think this PR looks good with the prepend_root_dir change in place.

@rallytime rallytime Jan 6, 2017 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@whiteinge Hm. Yeah I am assuming there was something going on later down the line that is using those pidfile and log_file settings somewhere in salt-api, especially since there was a change in this code recently in #37272, which removed the log_file setting and caused issue #38479. I didn't want to cause that bug again since that was fixed recently on this branch.

Just to make sure I am following you correctly, you're saying that the prepend_root_dir option also needs the pidfile and log_file settings? Something like this?

prepend_root_dir(opts, [
    'api_pidfile',
    'api_logfile',
    'log_file',
    'pidfile'
])

Or am I misunderstanding what you said?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No, you're exactly right. That addition makes everything work correctly for me in a quick local smoke test.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Perfect. I have made that change locally, but I am also writing some quick unit tests for this change. I'll push everything up when those are finished.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@rallytime Sounds good. Ping me when ready.

@rallytime

Copy link
Copy Markdown
Contributor Author

OK @cachedout and @whiteinge this should be good to go now, depending on the test run.

@rallytime rallytime removed the pending-discussion The issue or pull request needs more discussion before it can be closed or merged label Jan 9, 2017
@rallytime

Copy link
Copy Markdown
Contributor Author

Hrm. I am not sure how that reference to the /hello/word mocked log file settings is persisting and then getting consumed in the parsers unit tests...

Without this copy, the settings in DEFAULT_API_OPTS was getting overridden
by the new settings in the unit test. Let's copy those default settings,
and then restore them at the end of the test. These tests have also been
marked as destructive.
@rallytime

rallytime commented Jan 11, 2017 •

Copy link
Copy Markdown
Contributor Author

Found where those were getting set (in the salt.config.api_config function call itself). I have adjusted the tests to make a copy of those defaults before the test runs and then also restored those default settings at the end of the test run.

This should be ready now, pending the latest test run.

@rallytime

Copy link
Copy Markdown
Contributor Author

Go Go Jenkins!

1 similar comment
@rallytime

Copy link
Copy Markdown
Contributor Author

Go Go Jenkins!

@cachedout
cachedout merged commit bab3479 into saltstack:2016.3 Jan 17, 2017
@rallytime
rallytime deleted the follow-up-38527 branch January 17, 2017 18:41
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.

3 participants