parent
32fef233f2
commit
b3795322e9
|
@ -194,7 +194,7 @@ class KazooCommandProxy():
|
||||||
for i in dir(zstat):
|
for i in dir(zstat):
|
||||||
if not i.startswith('_'):
|
if not i.startswith('_'):
|
||||||
attr = getattr(zstat, i)
|
attr = getattr(zstat, i)
|
||||||
if type(attr) in (int, str):
|
if isinstance(attr, (int, str)):
|
||||||
stat_dict[i] = attr
|
stat_dict[i] = attr
|
||||||
result = True, {'msg': 'The node was retrieved.', 'znode': path, 'value': value,
|
result = True, {'msg': 'The node was retrieved.', 'znode': path, 'value': value,
|
||||||
'stat': stat_dict}
|
'stat': stat_dict}
|
||||||
|
|
|
@ -504,13 +504,13 @@ class Nmcli(object):
|
||||||
val=d[key]
|
val=d[key]
|
||||||
str_val=""
|
str_val=""
|
||||||
add_string=True
|
add_string=True
|
||||||
if type(val)==type(dbus.Array([])):
|
if isinstance(val, dbus.Array):
|
||||||
for elt in val:
|
for elt in val:
|
||||||
if type(elt)==type(dbus.Byte(1)):
|
if isinstance(elt, dbus.Byte):
|
||||||
str_val+="%s " % int(elt)
|
str_val+="%s " % int(elt)
|
||||||
elif type(elt)==type(dbus.String("")):
|
elif isinstance(elt, dbus.String):
|
||||||
str_val+="%s" % elt
|
str_val+="%s" % elt
|
||||||
elif type(val)==type(dbus.Dictionary({})):
|
elif isinstance(val, dbus.Dictionary):
|
||||||
dstr+=self.dict_to_string(val)
|
dstr+=self.dict_to_string(val)
|
||||||
add_string=False
|
add_string=False
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -238,7 +238,7 @@ class OSXDefaults(object):
|
||||||
value = "TRUE"
|
value = "TRUE"
|
||||||
else:
|
else:
|
||||||
value = "FALSE"
|
value = "FALSE"
|
||||||
elif type(self.value) is int or type(self.value) is float:
|
elif isinstance(self.value, (int, float)):
|
||||||
value = str(self.value)
|
value = str(self.value)
|
||||||
elif self.array_add and self.current_value is not None:
|
elif self.array_add and self.current_value is not None:
|
||||||
value = list(set(self.value) - set(self.current_value))
|
value = list(set(self.value) - set(self.current_value))
|
||||||
|
@ -285,7 +285,7 @@ class OSXDefaults(object):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# There is a type mismatch! Given type does not match the type in defaults
|
# There is a type mismatch! Given type does not match the type in defaults
|
||||||
if self.current_value is not None and type(self.current_value) is not type(self.value):
|
if self.current_value is not None and not isinstance(self.current_value, type(self.value)):
|
||||||
raise OSXDefaultsException("Type mismatch. Type in defaults: " + type(self.current_value).__name__)
|
raise OSXDefaultsException("Type mismatch. Type in defaults: " + type(self.current_value).__name__)
|
||||||
|
|
||||||
# Current value matches the given value. Nothing need to be done. Arrays need extra care
|
# Current value matches the given value. Nothing need to be done. Arrays need extra care
|
||||||
|
|
Loading…
Reference in New Issue