summaryrefslogtreecommitdiffstats
path: root/roles
diff options
context:
space:
mode:
authorKenny Woodson <kwoodson@redhat.com>2017-02-02 09:36:01 -0500
committerKenny Woodson <kwoodson@redhat.com>2017-02-02 09:36:01 -0500
commitf94417164f57891eb016ca5e98c6e713e1f66726 (patch)
tree642014ba4f9644bdb0ab768063c0d731a76185aa /roles
parent94fd71fa8fba70205519e18625975b83373c1535 (diff)
downloadopenshift-f94417164f57891eb016ca5e98c6e713e1f66726.tar.gz
openshift-f94417164f57891eb016ca5e98c6e713e1f66726.tar.bz2
openshift-f94417164f57891eb016ca5e98c6e713e1f66726.tar.xz
openshift-f94417164f57891eb016ca5e98c6e713e1f66726.zip
Fixing linters.
Diffstat (limited to 'roles')
-rw-r--r--roles/lib_openshift/library/oc_label.py11
-rw-r--r--roles/lib_openshift/src/ansible/oc_label.py4
-rw-r--r--roles/lib_openshift/src/class/oc_label.py7
-rw-r--r--roles/lib_openshift/src/test/integration/filter_plugins/filters.py1
-rwxr-xr-xroles/lib_openshift/src/test/integration/oc_label.yml85
-rwxr-xr-xroles/lib_openshift/src/test/unit/oc_label.py6
6 files changed, 17 insertions, 97 deletions
diff --git a/roles/lib_openshift/library/oc_label.py b/roles/lib_openshift/library/oc_label.py
index 8840bfefa..2096f0a1d 100644
--- a/roles/lib_openshift/library/oc_label.py
+++ b/roles/lib_openshift/library/oc_label.py
@@ -1265,7 +1265,7 @@ class OCLabel(OpenShiftCLI):
for current_host_labels in self.current_labels:
rbool = self.compare_labels(current_host_labels)
- if rbool == False:
+ if not rbool:
return False
return True
@@ -1318,8 +1318,8 @@ class OCLabel(OpenShiftCLI):
if len(extra_labels) > 0:
return True
- else:
- return False
+
+ return False
def replace(self):
''' replace currently stored labels with user provided labels '''
@@ -1401,6 +1401,7 @@ class OCLabel(OpenShiftCLI):
return self.openshift_cmd(cmd)
+ # pylint: disable=too-many-branches,too-many-return-statements
@staticmethod
def run_ansible(params, check_mode=False):
''' run the idempotent ansible code
@@ -1517,14 +1518,14 @@ def main():
choices=['present', 'absent', 'list', 'add']),
debug=dict(default=False, type='bool'),
kind=dict(default=None, type='str', required=True,
- choices=['node', 'pod', 'namespace']),
+ choices=['node', 'pod', 'namespace']),
name=dict(default=None, type='str'),
namespace=dict(default=None, type='str'),
labels=dict(default=None, type='list'),
selector=dict(default=None, type='str'),
),
supports_check_mode=True,
- mutually_exclusive = (['name', 'selector']),
+ mutually_exclusive=(['name', 'selector']),
)
results = OCLabel.run_ansible(module.params, module.check_mode)
diff --git a/roles/lib_openshift/src/ansible/oc_label.py b/roles/lib_openshift/src/ansible/oc_label.py
index 149b965d8..685712963 100644
--- a/roles/lib_openshift/src/ansible/oc_label.py
+++ b/roles/lib_openshift/src/ansible/oc_label.py
@@ -11,14 +11,14 @@ def main():
choices=['present', 'absent', 'list', 'add']),
debug=dict(default=False, type='bool'),
kind=dict(default=None, type='str', required=True,
- choices=['node', 'pod', 'namespace']),
+ choices=['node', 'pod', 'namespace']),
name=dict(default=None, type='str'),
namespace=dict(default=None, type='str'),
labels=dict(default=None, type='list'),
selector=dict(default=None, type='str'),
),
supports_check_mode=True,
- mutually_exclusive = (['name', 'selector']),
+ mutually_exclusive=(['name', 'selector']),
)
results = OCLabel.run_ansible(module.params, module.check_mode)
diff --git a/roles/lib_openshift/src/class/oc_label.py b/roles/lib_openshift/src/class/oc_label.py
index 4fc2ffc13..8e1ba9ceb 100644
--- a/roles/lib_openshift/src/class/oc_label.py
+++ b/roles/lib_openshift/src/class/oc_label.py
@@ -54,7 +54,7 @@ class OCLabel(OpenShiftCLI):
for current_host_labels in self.current_labels:
rbool = self.compare_labels(current_host_labels)
- if rbool == False:
+ if not rbool:
return False
return True
@@ -107,8 +107,8 @@ class OCLabel(OpenShiftCLI):
if len(extra_labels) > 0:
return True
- else:
- return False
+
+ return False
def replace(self):
''' replace currently stored labels with user provided labels '''
@@ -190,6 +190,7 @@ class OCLabel(OpenShiftCLI):
return self.openshift_cmd(cmd)
+ # pylint: disable=too-many-branches,too-many-return-statements
@staticmethod
def run_ansible(params, check_mode=False):
''' run the idempotent ansible code
diff --git a/roles/lib_openshift/src/test/integration/filter_plugins/filters.py b/roles/lib_openshift/src/test/integration/filter_plugins/filters.py
index 6acbb47ec..71a29ab7d 100644
--- a/roles/lib_openshift/src/test/integration/filter_plugins/filters.py
+++ b/roles/lib_openshift/src/test/integration/filter_plugins/filters.py
@@ -5,6 +5,7 @@
Custom filters for use in testing
'''
+
class FilterModule(object):
''' Custom ansible filters '''
diff --git a/roles/lib_openshift/src/test/integration/oc_label.yml b/roles/lib_openshift/src/test/integration/oc_label.yml
index 0a2d438bd..ce9bc25bb 100755
--- a/roles/lib_openshift/src/test/integration/oc_label.yml
+++ b/roles/lib_openshift/src/test/integration/oc_label.yml
@@ -15,8 +15,8 @@
msg: "{{ item }} not defined"
when: "{{ item }} is not defined"
with_items:
- - cli_node_test #openshift node to be used to add/remove labels to
- - cli_master_test #ansible inventory instance to run playbook against
+ - cli_node_test # openshift node to be used to add/remove labels to
+ - cli_master_test # ansible inventory instance to run playbook against
tasks:
- name: delete test labels (start from known starting position)
@@ -321,84 +321,3 @@
assert:
that: label_out['results']['labels'][0]['testlabel2'] is not defined
msg: "{{ label_out }}"
-
-
-
-
-
-
-
-
-
-
-
-# - name: create route
-# oc_route:
-# name: test
-# namespace: default
-# tls_termination: edge
-# cert_content: testing cert
-# cacert_content: testing cacert
-# key_content: key content
-# service_name: test
-# host: test.example
-# register: routeout
-# - debug: var=routeout
-#
-# - assert:
-# that: "routeout.results.results[0]['metadata']['name'] == 'test'"
-# msg: route create failed
-#
-# - name: get route
-# oc_route:
-# state: list
-# name: test
-# namespace: default
-# register: routeout
-# - debug: var=routeout
-#
-# - assert:
-# that: "routeout.results[0]['metadata']['name'] == 'test'"
-# msg: get route failed
-#
-# - name: delete route
-# oc_route:
-# state: absent
-# name: test
-# namespace: default
-# register: routeout
-# - debug: var=routeout
-#
-# - assert:
-# that: "routeout.results.returncode == 0"
-# msg: delete route failed
-#
-# - name: create route
-# oc_route:
-# name: test
-# namespace: default
-# tls_termination: edge
-# cert_content: testing cert
-# cacert_content: testing cacert
-# key_content: testing key
-# service_name: test
-# host: test.example
-# register: routeout
-# - debug: var=routeout
-#
-# - name: create route noop
-# oc_route:
-# name: test
-# namespace: default
-# tls_termination: edge
-# cert_content: testing cert
-# cacert_content: testing cacert
-# key_content: testing key
-# service_name: test
-# host: test.example
-# register: routeout
-# - debug: var=routeout
-#
-# - assert:
-# that: "routeout.changed == False"
-# msg: Route create not idempotent
diff --git a/roles/lib_openshift/src/test/unit/oc_label.py b/roles/lib_openshift/src/test/unit/oc_label.py
index 875b97c42..3f7162070 100755
--- a/roles/lib_openshift/src/test/unit/oc_label.py
+++ b/roles/lib_openshift/src/test/unit/oc_label.py
@@ -78,7 +78,6 @@ class OCLabelTest(unittest.TestCase):
}
}'''
-
mock_cmd.side_effect = [
(0, ns, ''),
]
@@ -166,7 +165,6 @@ class OCLabelTest(unittest.TestCase):
}
}'''
-
mock_cmd.side_effect = [
(0, ns, ''),
(0, '', ''),
@@ -176,8 +174,8 @@ class OCLabelTest(unittest.TestCase):
results = OCLabel.run_ansible(params, False)
self.assertTrue(results['changed'])
- self.assertTrue(results['results']['results']['labels'][0] == \
- {'storage_pv_quota': 'False', 'awesomens': 'testinglabel'})
+ self.assertTrue(results['results']['results']['labels'][0] ==
+ {'storage_pv_quota': 'False', 'awesomens': 'testinglabel'})
def tearDown(self):
'''TearDown method'''