Merge "Replace mknod() with chmod()"

This commit is contained in:
Jenkins 2014-06-17 21:13:45 +00:00 committed by Gerrit Code Review
commit 7a802ca9d3
2 changed files with 4 additions and 4 deletions

View File

@ -90,8 +90,8 @@ def make_persistent_password_file(path, password):
try:
utils.delete_if_exists(path)
os.mknod(path, 0o600)
with open(path, 'wb') as file:
os.chmod(path, 0o600)
file.write(password)
return path
except Exception as e:

View File

@ -121,9 +121,9 @@ class ConsoleUtilsTestCase(base.TestCase):
# delete the file
os.unlink(filepath)
@mock.patch.object(os, 'mknod', autospec=True)
def test_make_persistent_password_file_fail(self, mock_mknod):
mock_mknod.side_effect = IOError()
@mock.patch.object(os, 'chmod', autospec=True)
def test_make_persistent_password_file_fail(self, mock_chmod):
mock_chmod.side_effect = IOError()
filepath = '%(tempdir)s/%(node_uuid)s' % {
'tempdir': tempfile.gettempdir(),
'node_uuid': self.info['uuid']}