Update old util paths to new paths

This commit is contained in:
rallytime 2017-11-13 12:35:31 -05:00
parent 4e2280157a
commit 59ddde4671
No known key found for this signature in database
GPG Key ID: E8F1A4B90D0DEA19
4 changed files with 13 additions and 10 deletions

View File

@ -15,7 +15,9 @@ import salt.client.ssh.shell
import salt.client.ssh.state
import salt.utils.args
import salt.utils.data
import salt.utils.files
import salt.utils.hashutils
import salt.utils.platform
import salt.utils.thin
import salt.roster
import salt.state
@ -337,10 +339,10 @@ def request(mods=None,
})
cumask = os.umask(0o77)
try:
if salt.utils.is_windows():
if salt.utils.platform.is_windows():
# Make sure cache file isn't read-only
__salt__['cmd.run']('attrib -R "{0}"'.format(notify_path))
with salt.utils.fopen(notify_path, 'w+b') as fp_:
with salt.utils.files.fopen(notify_path, 'w+b') as fp_:
serial.dump(req, fp_)
except (IOError, OSError):
msg = 'Unable to write state request file {0}. Check permission.'
@ -364,7 +366,7 @@ def check_request(name=None):
notify_path = os.path.join(__opts__['cachedir'], 'req_state.p')
serial = salt.payload.Serial(__opts__)
if os.path.isfile(notify_path):
with salt.utils.fopen(notify_path, 'rb') as fp_:
with salt.utils.files.fopen(notify_path, 'rb') as fp_:
req = serial.load(fp_)
if name:
return req[name]
@ -401,10 +403,10 @@ def clear_request(name=None):
return False
cumask = os.umask(0o77)
try:
if salt.utils.is_windows():
if salt.utils.platform.is_windows():
# Make sure cache file isn't read-only
__salt__['cmd.run']('attrib -R "{0}"'.format(notify_path))
with salt.utils.fopen(notify_path, 'w+b') as fp_:
with salt.utils.files.fopen(notify_path, 'w+b') as fp_:
serial.dump(req, fp_)
except (IOError, OSError):
msg = 'Unable to write state request file {0}. Check permission.'

View File

@ -8,10 +8,10 @@ from tests.support.case import SSHCase
from tests.support.unit import skipIf
# Import Salt Libs
import salt.utils
import salt.utils.platform
@skipIf(salt.utils.is_windows(), 'salt-ssh not available on Windows')
@skipIf(salt.utils.platform.is_windows(), 'salt-ssh not available on Windows')
class SSHGrainsTest(SSHCase):
'''
testing grains with salt-ssh

View File

@ -8,10 +8,10 @@ from tests.support.case import SSHCase
from tests.support.unit import skipIf
# Import Salt Libs
import salt.utils
import salt.utils.platform
@skipIf(salt.utils.is_windows(), 'salt-ssh not available on Windows')
@skipIf(salt.utils.platform.is_windows(), 'salt-ssh not available on Windows')
class SSHRawTest(SSHCase):
'''
testing salt-ssh with raw calls

View File

@ -20,6 +20,7 @@ from tests.support.paths import TMP, CODE_DIR
# Import salt libs
import salt.utils.cloud as cloud
import salt.utils.platform
GPG_KEYDIR = os.path.join(TMP, 'gpg-keydir')
@ -123,7 +124,7 @@ class CloudUtilsTestCase(TestCase):
# we successful pass the place with os.write(tmpfd, ...
self.assertNotEqual("a bytes-like object is required, not 'str'", str(context.exception))
@skipIf(salt.utils.is_windows(), 'Not applicable to Windows')
@skipIf(salt.utils.platform.is_windows(), 'Not applicable to Windows')
def test_check_key_path_and_mode(self):
with tempfile.NamedTemporaryFile() as f:
key_file = f.name