Translate python2 to python3
*opencas.py*: changed result class to contain text values instead of bytes, translated chache configuring methods to py3, *init script*: changed regex input on raw string to work in py3. Signed-off-by: Slawomir_Jankowski <slawomir.jankowski@intel.com>
This commit is contained in:
committed by
Slawomir_Jankowski
parent
d01c26d629
commit
3d5d82f892
@@ -17,11 +17,11 @@ class casadm:
|
||||
|
||||
class result:
|
||||
def __init__(self, cmd):
|
||||
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
self.exit_code = p.wait()
|
||||
output = p.communicate()
|
||||
self.stdout = output[0]
|
||||
self.stderr = output[1]
|
||||
p = subprocess.run(cmd, universal_newlines=True, stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
self.exit_code = p.returncode
|
||||
self.stdout = p.stdout
|
||||
self.stderr = p.stderr
|
||||
|
||||
class CasadmError(Exception):
|
||||
def __init__(self, result):
|
||||
@@ -500,10 +500,10 @@ def start_cache(cache, load, force=False):
|
||||
force=force)
|
||||
|
||||
def configure_cache(cache):
|
||||
if cache.params.has_key('cleaning_policy'):
|
||||
if 'cleaning_policy' in cache.params:
|
||||
casadm.set_param('cleaning', cache_id=cache.cache_id,
|
||||
policy=cache.params['cleaning_policy'])
|
||||
if cache.params.has_key('ioclass_file'):
|
||||
if 'ioclass_file' in cache.params:
|
||||
casadm.io_class_load_config(cache_id=cache.cache_id,
|
||||
ioclass_file=cache.params['ioclass_file'])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user