summaryrefslogtreecommitdiffstats
path: root/roles/lib_openshift/library/oc_serviceaccount_secret.py
diff options
context:
space:
mode:
authorKenny Woodson <kwoodson@redhat.com>2017-02-16 16:53:14 -0500
committerKenny Woodson <kwoodson@redhat.com>2017-02-16 16:53:14 -0500
commitc4e712ba3cc40d1deed87f56c71b337193597422 (patch)
tree99b0531dbf294253771cb0ec6c313e569640ba70 /roles/lib_openshift/library/oc_serviceaccount_secret.py
parentd4db2dd279916c2a1f73c236deed444fed5cc740 (diff)
downloadopenshift-c4e712ba3cc40d1deed87f56c71b337193597422.tar.gz
openshift-c4e712ba3cc40d1deed87f56c71b337193597422.tar.bz2
openshift-c4e712ba3cc40d1deed87f56c71b337193597422.tar.xz
openshift-c4e712ba3cc40d1deed87f56c71b337193597422.zip
Pleasing the linting gods.
Diffstat (limited to 'roles/lib_openshift/library/oc_serviceaccount_secret.py')
-rw-r--r--roles/lib_openshift/library/oc_serviceaccount_secret.py19
1 files changed, 14 insertions, 5 deletions
diff --git a/roles/lib_openshift/library/oc_serviceaccount_secret.py b/roles/lib_openshift/library/oc_serviceaccount_secret.py
index 3eb20779c..0a07d1b42 100644
--- a/roles/lib_openshift/library/oc_serviceaccount_secret.py
+++ b/roles/lib_openshift/library/oc_serviceaccount_secret.py
@@ -315,12 +315,12 @@ class Yedit(object):
if self.backup and self.file_exists():
shutil.copy(self.filename, self.filename + '.orig')
- # pylint: disable=no-member
- if hasattr(self.yaml_dict, 'fa'):
- self.yaml_dict.fa.set_block_style()
-
- # pylint: disable=no-member
if hasattr(yaml, 'RoundTripDumper'):
+ # pylint: disable=no-member
+ if hasattr(self.yaml_dict, 'fa'):
+ self.yaml_dict.fa.set_block_style()
+
+ # pylint: disable=no-member
Yedit._write(self.filename, yaml.dump(self.yaml_dict, Dumper=yaml.RoundTripDumper))
else:
Yedit._write(self.filename, yaml.safe_dump(self.yaml_dict, default_flow_style=False))
@@ -363,13 +363,16 @@ class Yedit(object):
# check if it is yaml
try:
if content_type == 'yaml' and contents:
+ # pylint: disable=no-member
if hasattr(yaml, 'RoundTripLoader'):
self.yaml_dict = yaml.load(contents, yaml.RoundTripLoader)
else:
self.yaml_dict = yaml.safe_load(contents)
+
# pylint: disable=no-member
if hasattr(self.yaml_dict, 'fa'):
self.yaml_dict.fa.set_block_style()
+
elif content_type == 'json' and contents:
self.yaml_dict = json.loads(contents)
except yaml.YAMLError as err:
@@ -535,6 +538,7 @@ class Yedit(object):
# deepcopy didn't work
if hasattr(yaml, 'round_trip_dump'):
+ # pylint: disable=no-member
tmp_copy = yaml.load(yaml.round_trip_dump(self.yaml_dict,
default_flow_style=False),
yaml.RoundTripLoader)
@@ -559,8 +563,10 @@ class Yedit(object):
if not self.file_exists():
# deepcopy didn't work
if hasattr(yaml, 'round_trip_dump'):
+ # pylint: disable=no-member
tmp_copy = yaml.load(yaml.round_trip_dump(self.yaml_dict, default_flow_style=False), # noqa: E501
yaml.RoundTripLoader)
+
# pylint: disable=no-member
if hasattr(self.yaml_dict, 'fa'):
tmp_copy.fa.set_block_style()
@@ -1008,10 +1014,12 @@ class Utils(object):
tmp = Utils.create_tmpfile(prefix=rname)
if ftype == 'yaml':
+ # pylint: disable=no-member
if hasattr(yaml, 'RoundTripDumper'):
Utils._write(tmp, yaml.dump(data, Dumper=yaml.RoundTripDumper))
else:
Utils._write(tmp, yaml.safe_dump(data, default_flow_style=False))
+
elif ftype == 'json':
Utils._write(tmp, json.dumps(data))
else:
@@ -1093,6 +1101,7 @@ class Utils(object):
contents = sfd.read()
if sfile_type == 'yaml':
+ # pylint: disable=no-member
if hasattr(yaml, 'RoundTripLoader'):
contents = yaml.load(contents, yaml.RoundTripLoader)
else: