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

[master] Porting #52933 to master #54576

Merged
merged 4 commits into from
Nov 15, 2019

Conversation

garethgreenaway
Copy link
Contributor

@garethgreenaway garethgreenaway commented Sep 19, 2019

Porting #52933 to master

@garethgreenaway garethgreenaway requested a review from a team September 19, 2019 00:04
@ghost ghost requested review from DmitryKuzmenko and removed request for a team September 19, 2019 00:05
@garethgreenaway garethgreenaway changed the title [2019.2.1] Porting #52933 to 2019.2.1 [master] Porting #52933 to master Sep 24, 2019
@garethgreenaway garethgreenaway changed the base branch from 2019.2.1 to master September 24, 2019 22:53
@dwoz dwoz requested a review from a team as a code owner October 28, 2019 15:56
Copy link
Collaborator

@s0undt3ch s0undt3ch left a comment

Choose a reason for hiding this comment

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

None of my review comments are blockers. It would just make the code better, more readable.

@@ -117,6 +117,10 @@ def validate(config):
if 'files' not in _config:
return False, 'Configuration for inotify beacon must include files.'
else:
if not isinstance(_config['files'], dict):
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would remove the above else and dedent this logic.

@@ -39,10 +39,33 @@ def setUp(self):
def tearDown(self):
shutil.rmtree(self.tmpdir, ignore_errors=True)

def test_non_list_config(self):
config = {}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Unnecessary variable, just pass {} to inotify.validate().


self.assertEqual(ret, (False, 'Configuration for inotify beacon must'
' be a list.'))

def test_empty_config(self):
config = [{}]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same as above.

self.assertEqual(ret, _expected)

def test_files_none_config(self):
config = [{'files': None}]
Copy link
Collaborator

Choose a reason for hiding this comment

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

I won't say same as above here, although we don't actually use config anywhere else.
But for the sake of readability, let's leave it.
The same for the next test.

if not isinstance(_config['files'], dict):
return False, ('Configuration for inotify beacon invalid, '
'files must be a dict.')

for path in _config.get('files'):

if not isinstance(_config['files'][path], dict):
Copy link
Contributor

Choose a reason for hiding this comment

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

Configuration for inotify beacon must be a list of dictionaries.

This error is not correct, it must be a dict of dicts (which this PR validates).

@dwoz dwoz merged commit 9edcfab into saltstack:master Nov 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants