summaryrefslogtreecommitdiffstats
path: root/roles/lib_utils
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_utils
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_utils')
-rw-r--r--roles/lib_utils/library/repoquery.py2
-rw-r--r--roles/lib_utils/library/yedit.py18
-rw-r--r--roles/lib_utils/src/class/yedit.py16
-rw-r--r--roles/lib_utils/src/lib/import.py2
4 files changed, 25 insertions, 13 deletions
diff --git a/roles/lib_utils/library/repoquery.py b/roles/lib_utils/library/repoquery.py
index 235518e9d..cc7aa04fd 100644
--- a/roles/lib_utils/library/repoquery.py
+++ b/roles/lib_utils/library/repoquery.py
@@ -39,7 +39,7 @@ import shutil # noqa: F401
try:
import ruamel.yaml as yaml # noqa: F401
except ImportError:
- import yaml
+ import yaml # noqa: F401
from ansible.module_utils.basic import AnsibleModule
diff --git a/roles/lib_utils/library/yedit.py b/roles/lib_utils/library/yedit.py
index 7f71e6cbc..a358e980e 100644
--- a/roles/lib_utils/library/yedit.py
+++ b/roles/lib_utils/library/yedit.py
@@ -39,7 +39,7 @@ import shutil # noqa: F401
try:
import ruamel.yaml as yaml # noqa: F401
except ImportError:
- import yaml
+ import yaml # noqa: F401
from ansible.module_utils.basic import AnsibleModule
@@ -380,12 +380,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))
@@ -428,13 +428,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:
@@ -600,6 +603,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)
@@ -624,8 +628,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()
diff --git a/roles/lib_utils/src/class/yedit.py b/roles/lib_utils/src/class/yedit.py
index cecc1ed4f..5275e84eb 100644
--- a/roles/lib_utils/src/class/yedit.py
+++ b/roles/lib_utils/src/class/yedit.py
@@ -194,12 +194,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))
@@ -242,13 +242,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:
@@ -414,6 +417,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)
@@ -438,8 +442,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()
diff --git a/roles/lib_utils/src/lib/import.py b/roles/lib_utils/src/lib/import.py
index ea9fb8ce5..ed57a68c9 100644
--- a/roles/lib_utils/src/lib/import.py
+++ b/roles/lib_utils/src/lib/import.py
@@ -14,6 +14,6 @@ import shutil # noqa: F401
try:
import ruamel.yaml as yaml # noqa: F401
except ImportError:
- import yaml
+ import yaml # noqa: F401
from ansible.module_utils.basic import AnsibleModule