summaryrefslogtreecommitdiff
path: root/ironic/drivers/modules/console_utils.py
diff options
context:
space:
mode:
authorChangBo Guo(gcb) <eric.guo@easystack.cn>2016-09-29 13:53:20 +0800
committerChangBo Guo(gcb) <eric.guo@easystack.cn>2016-10-01 05:40:29 +0800
commit827934114928bf55878782b6366443bfe52ad845 (patch)
treee8696a05c8a97f56d25657a5eb96244546a1ecd7 /ironic/drivers/modules/console_utils.py
parentc445c19285c2f3ee6a099f9f7473dd6fe087116b (diff)
downloadironic-827934114928bf55878782b6366443bfe52ad845.tar.gz
Use method delete_if_exists from oslo.utils
oslo.utils provides same method[1] in module fileutils, and just use it. TrivialFix [1]https://github.com/openstack/oslo.utils/blob/9981276fe6e58c576b69b06afd3662e8c981136c/oslo_utils/fileutils.py#L49-L60 Change-Id: Ic83cfa28f96f97af17f19eda950fc6709ce12760
Diffstat (limited to 'ironic/drivers/modules/console_utils.py')
-rw-r--r--ironic/drivers/modules/console_utils.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/ironic/drivers/modules/console_utils.py b/ironic/drivers/modules/console_utils.py
index ffb22537f..c8195ddf2 100644
--- a/ironic/drivers/modules/console_utils.py
+++ b/ironic/drivers/modules/console_utils.py
@@ -29,11 +29,11 @@ import time
from ironic_lib import utils as ironic_utils
from oslo_log import log as logging
from oslo_service import loopingcall
+from oslo_utils import fileutils
from oslo_utils import netutils
from ironic.common import exception
from ironic.common.i18n import _, _LE, _LW
-from ironic.common import utils
from ironic.conf import CONF
@@ -117,13 +117,13 @@ def make_persistent_password_file(path, password):
"""Writes a file containing a password until deleted."""
try:
- utils.delete_if_exists(path)
+ fileutils.delete_if_exists(path)
with open(path, 'wb') as file:
os.chmod(path, 0o600)
file.write(password.encode())
return path
except Exception as e:
- utils.delete_if_exists(path)
+ fileutils.delete_if_exists(path)
raise exception.PasswordFileFailedToCreate(error=e)