Skip to content

Commit

Permalink
kcli list apps -P type=openshift
Browse files Browse the repository at this point in the history
  • Loading branch information
karmab committed Jan 21, 2025
1 parent 41a72a3 commit 3fbdc2f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
8 changes: 4 additions & 4 deletions kvirt/baseconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,7 @@ def info_openshift_sno(self, quiet, web=False):
self.info_plan(inputfile, quiet=quiet, web=web)

def create_app(self, app, overrides={}, outputdir=None):
kubetype = overrides.get('kubetype') or get_kubetype()
kubetype = get_kubetype(overrides)
if kubetype == 'openshift':
return self.create_app_openshift(app, overrides, outputdir)
elif kubetype == 'eks':
Expand Down Expand Up @@ -1014,7 +1014,7 @@ def create_app_openshift(self, app, overrides={}, outputdir=None):
return common.create_app_openshift(self, app, appdir, app_data, outputdir)

def delete_app(self, app, overrides={}):
kubetype = overrides.get('kubetype') or get_kubetype()
kubetype = get_kubetype(overrides)
if kubetype == 'openshift':
return self.delete_app_openshift(app, overrides)
elif kubetype == 'eks':
Expand Down Expand Up @@ -1047,7 +1047,7 @@ def delete_app_openshift(self, app, overrides={}):
return common.delete_app_openshift(self, app, appdir, app_data)

def info_app(self, app, overrides={}):
kubetype = overrides.get('kubetype') or get_kubetype()
kubetype = get_kubetype(overrides)
if kubetype == 'openshift':
return self.info_app_openshift(app, overrides)
elif kubetype == 'eks':
Expand Down Expand Up @@ -1093,7 +1093,7 @@ def info_app_openshift(self, app, overrides={}):
print(f.read().strip())

def list_apps(self, quiet=True, installed=False, overrides={}):
kubetype = overrides.get('kubetype') or get_kubetype()
kubetype = get_kubetype(overrides)
if kubetype == 'openshift':
return self.list_apps_openshift(quiet=quiet, installed=installed)
elif kubetype == 'eks':
Expand Down
5 changes: 4 additions & 1 deletion kvirt/common/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2570,7 +2570,10 @@ def sdn_ip(ip, kubetype, cluster_network):
return kubetype is not None and kubetype == 'openshift' and ip_address(ip) in ip_network(cluster_network)


def get_kubetype():
def get_kubetype(overrides):
kubetype = overrides.get('kubetype') or overrides.get('type')
if kubetype is not None:
return kubetype
kubectl = which('kubectl') or which('oc')
openshift_command = f'{kubectl} get project 2>/dev/null'
cloud_command = f'{kubectl} cluster-info'
Expand Down

0 comments on commit 3fbdc2f

Please sign in to comment.