Merge "Replace mknod() with chmod()"
This commit is contained in:
commit
7a802ca9d3
@ -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:
|
||||
|
@ -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']}
|
||||
|
Loading…
x
Reference in New Issue
Block a user