summaryrefslogtreecommitdiffstats
path: root/roles/lib_openshift/src
diff options
context:
space:
mode:
authorKenny Woodson <kwoodson@redhat.com>2017-03-01 11:04:50 -0500
committerKenny Woodson <kwoodson@redhat.com>2017-03-06 09:09:14 -0500
commit4d8df54bd8449a350e3eba59d9598b50d2e727ff (patch)
tree8d8ee891e1bd6553abf83da2d2c26b09e2e1b414 /roles/lib_openshift/src
parent9ed2463827c2eeb7b5adae9d2878ffbdd81cbc74 (diff)
downloadopenshift-4d8df54bd8449a350e3eba59d9598b50d2e727ff.tar.gz
openshift-4d8df54bd8449a350e3eba59d9598b50d2e727ff.tar.bz2
openshift-4d8df54bd8449a350e3eba59d9598b50d2e727ff.tar.xz
openshift-4d8df54bd8449a350e3eba59d9598b50d2e727ff.zip
Fixed docs. Added check for delete failures. Updated namespace to None.
Diffstat (limited to 'roles/lib_openshift/src')
-rw-r--r--roles/lib_openshift/src/class/oc_project.py6
-rw-r--r--roles/lib_openshift/src/lib/project.py15
2 files changed, 12 insertions, 9 deletions
diff --git a/roles/lib_openshift/src/class/oc_project.py b/roles/lib_openshift/src/class/oc_project.py
index cf378ef6d..642d85375 100644
--- a/roles/lib_openshift/src/class/oc_project.py
+++ b/roles/lib_openshift/src/class/oc_project.py
@@ -4,7 +4,7 @@
# pylint: disable=too-many-instance-attributes
class OCProject(OpenShiftCLI):
- ''' Class to wrap the oc command line tools '''
+ ''' Project Class to manage project/namespace objects'''
kind = 'namespace'
def __init__(self,
@@ -86,7 +86,6 @@ class OCProject(OpenShiftCLI):
if result != self.config.config_options['node_selector']['value']:
return True
- # Check rolebindings and policybindings
return False
# pylint: disable=too-many-return-statements,too-many-branches
@@ -131,6 +130,9 @@ class OCProject(OpenShiftCLI):
api_rval = oadm_project.delete()
+ if api_rval['returncode'] != 0:
+ return {'failed': True, 'msg': api_rval}
+
return {'changed': True, 'results': api_rval, 'state': state}
return {'changed': False, 'state': state}
diff --git a/roles/lib_openshift/src/lib/project.py b/roles/lib_openshift/src/lib/project.py
index a06f83d78..40994741c 100644
--- a/roles/lib_openshift/src/lib/project.py
+++ b/roles/lib_openshift/src/lib/project.py
@@ -6,24 +6,25 @@
class ProjectConfig(OpenShiftCLIConfig):
''' project config object '''
def __init__(self, rname, namespace, kubeconfig, project_options):
- super(ProjectConfig, self).__init__(rname, rname, kubeconfig, project_options)
+ super(ProjectConfig, self).__init__(rname, None, kubeconfig, project_options)
+
class Project(Yedit):
''' Class to wrap the oc command line tools '''
annotations_path = "metadata.annotations"
- kind = 'Service'
+ kind = 'Project'
annotation_prefix = 'openshift.io/'
def __init__(self, content):
- '''Service constructor'''
+ '''Project constructor'''
super(Project, self).__init__(content=content)
def get_annotations(self):
- ''' get a list of ports '''
+ ''' return the annotations'''
return self.get(Project.annotations_path) or {}
def add_annotations(self, inc_annos):
- ''' add a port object to the ports list '''
+ ''' add an annotation to the other annotations'''
if not isinstance(inc_annos, list):
inc_annos = [inc_annos]
@@ -38,7 +39,7 @@ class Project(Yedit):
return True
def find_annotation(self, key):
- ''' find a specific port '''
+ ''' find an annotation'''
annotations = self.get_annotations()
for anno in annotations:
if Project.annotation_prefix + key == anno:
@@ -66,7 +67,7 @@ class Project(Yedit):
return removed
def update_annotation(self, key, value):
- ''' remove an annotation from a project'''
+ ''' remove an annotation for a project'''
annos = self.get(Project.annotations_path) or {}
if not annos: