diff options
author | Kenny Woodson <kwoodson@redhat.com> | 2017-01-19 12:30:41 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-19 12:30:41 -0500 |
commit | 47e3f2f787cd3c431820b6d1a5037dcfd44d3023 (patch) | |
tree | 37b1a8115be46136d4577c87d2dd6e45bae3b205 /roles/lib_openshift/src/lib/base.py | |
parent | 1df10b57ea457bb186b3403d4fab06f0db28d11c (diff) | |
parent | 2d122d692bf14b939dcaefd4ca46d018a198eb56 (diff) | |
download | openshift-47e3f2f787cd3c431820b6d1a5037dcfd44d3023.tar.gz openshift-47e3f2f787cd3c431820b6d1a5037dcfd44d3023.tar.bz2 openshift-47e3f2f787cd3c431820b6d1a5037dcfd44d3023.tar.xz openshift-47e3f2f787cd3c431820b6d1a5037dcfd44d3023.zip |
Merge pull request #3117 from kwoodson/lib_openshift
Adding modules to lib_openshift.
Diffstat (limited to 'roles/lib_openshift/src/lib/base.py')
-rw-r--r-- | roles/lib_openshift/src/lib/base.py | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/roles/lib_openshift/src/lib/base.py b/roles/lib_openshift/src/lib/base.py index 915a7caca..cf2f1b14d 100644 --- a/roles/lib_openshift/src/lib/base.py +++ b/roles/lib_openshift/src/lib/base.py @@ -47,14 +47,14 @@ class OpenShiftCLI(object): return {'returncode': 0, 'updated': False} def _replace(self, fname, force=False): - '''return all pods ''' + '''replace the current object with oc replace''' cmd = ['-n', self.namespace, 'replace', '-f', fname] if force: cmd.append('--force') return self.openshift_cmd(cmd) def _create_from_content(self, rname, content): - '''return all pods ''' + '''create a temporary file and then call oc create on it''' fname = '/tmp/%s' % rname yed = Yedit(fname, content=content) yed.write() @@ -64,11 +64,11 @@ class OpenShiftCLI(object): return self._create(fname) def _create(self, fname): - '''return all pods ''' + '''call oc create on a filename''' return self.openshift_cmd(['create', '-f', fname, '-n', self.namespace]) def _delete(self, resource, rname, selector=None): - '''return all pods ''' + '''call oc delete on a resource''' cmd = ['delete', resource, rname, '-n', self.namespace] if selector: cmd.append('--selector=%s' % selector) @@ -76,7 +76,14 @@ class OpenShiftCLI(object): return self.openshift_cmd(cmd) def _process(self, template_name, create=False, params=None, template_data=None): # noqa: E501 - '''return all pods ''' + '''process a template + + template_name: the name of the template to process + create: whether to send to oc create after processing + params: the parameters for the template + template_data: the incoming template's data; instead of a file + ''' + cmd = ['process', '-n', self.namespace] if template_data: cmd.extend(['-f', '-']) @@ -138,7 +145,12 @@ class OpenShiftCLI(object): return self.openshift_cmd(cmd, oadm=True, output=True, output_type='raw') # noqa: E501 def _list_pods(self, node=None, selector=None, pod_selector=None): - ''' perform oadm manage-node evacuate ''' + ''' perform oadm list pods + + node: the node in which to list pods + selector: the label selector filter if provided + pod_selector: the pod selector filter if provided + ''' cmd = ['manage-node'] if node: cmd.extend(node) |