Merge "Fix chown command for tripleo validation."

This commit is contained in:
Zuul 2018-02-19 20:46:07 +00:00 committed by Gerrit Code Review
commit afc399096c
3 changed files with 4 additions and 4 deletions

View File

@ -3,7 +3,6 @@ Defaults:validations !requiretty
Defaults:mistral !requiretty
mistral ALL = (validations) NOPASSWD:SETENV: /usr/bin/run-validation
mistral ALL = NOPASSWD: /usr/bin/chown -h validations\: /tmp/validations_identity_[A-Za-z0-9_][A-Za-z0-9_][A-Za-z0-9_][A-Za-z0-9_][A-Za-z0-9_][A-Za-z0-9_], \
/usr/bin/chown validations\: /tmp/validations_identity_[A-Za-z0-9_][A-Za-z0-9_][A-Za-z0-9_][A-Za-z0-9_][A-Za-z0-9_][A-Za-z0-9_], \
!/usr/bin/chown /tmp/validations_identity_* *, !/usr/bin/chown /tmp/validations_identity_*..*
mistral ALL = NOPASSWD: /usr/bin/rm -f /tmp/validations_identity_[A-Za-z0-9_][A-Za-z0-9_][A-Za-z0-9_][A-Za-z0-9_][A-Za-z0-9_][A-Za-z0-9_], \
!/usr/bin/rm /tmp/validations_identity_* *, !/usr/bin/rm /tmp/validations_identity_*..*

View File

@ -101,7 +101,8 @@ class ValidationsKeyTest(base.TestCase):
mock_open_context.assert_called_once_with('fd', 'w')
mock_open_context().write.assert_called_once_with('private_key')
mock_execute.assert_called_once_with(
'/usr/bin/sudo', '/usr/bin/chown', 'validations:', 'tmp_path')
'/usr/bin/sudo', '/usr/bin/chown', '-h', 'validations:',
'tmp_path')
@mock.patch("oslo_concurrency.processutils.execute")
def test_cleanup_identity_file(self, mock_execute):

View File

@ -97,8 +97,8 @@ def write_identity_file(key):
LOG.debug('Writing SSH key to disk at %s', path)
with os.fdopen(fd, 'w') as tmp:
tmp.write(key)
processutils.execute('/usr/bin/sudo', '/usr/bin/chown', 'validations:',
path)
processutils.execute('/usr/bin/sudo', '/usr/bin/chown', '-h',
'validations:', path)
return path