summaryrefslogtreecommitdiff
path: root/ironic
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2014-06-17 21:13:45 +0000
committerGerrit Code Review <review@openstack.org>2014-06-17 21:13:45 +0000
commit7a802ca9d3100ba250dbbfa12403ea89f8a20b25 (patch)
tree987b4d5c38b511659883ca17eef9161df929c80c /ironic
parent140a9bbb504588381f17dd01048e9ceea2c5f69e (diff)
parent8f968c3d7faf27b7d765676558fe80ebf331afe0 (diff)
downloadironic-7a802ca9d3100ba250dbbfa12403ea89f8a20b25.tar.gz
Merge "Replace mknod() with chmod()"
Diffstat (limited to 'ironic')
-rw-r--r--ironic/drivers/modules/console_utils.py2
-rw-r--r--ironic/tests/drivers/test_console_utils.py6
2 files changed, 4 insertions, 4 deletions
diff --git a/ironic/drivers/modules/console_utils.py b/ironic/drivers/modules/console_utils.py
index abc3ab496..bf60e9cc7 100644
--- a/ironic/drivers/modules/console_utils.py
+++ b/ironic/drivers/modules/console_utils.py
@@ -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:
diff --git a/ironic/tests/drivers/test_console_utils.py b/ironic/tests/drivers/test_console_utils.py
index 9f9bc4b1d..fb2ecdf73 100644
--- a/ironic/tests/drivers/test_console_utils.py
+++ b/ironic/tests/drivers/test_console_utils.py
@@ -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']}