|
|
@ -64,7 +64,6 @@ class KubernetesLookup(object):
|
|
|
|
self.connection = {}
|
|
|
|
self.connection = {}
|
|
|
|
|
|
|
|
|
|
|
|
def run(self, terms, variables=None, **kwargs):
|
|
|
|
def run(self, terms, variables=None, **kwargs):
|
|
|
|
self.mylog('Here!')
|
|
|
|
|
|
|
|
self.kind = kwargs.get('kind')
|
|
|
|
self.kind = kwargs.get('kind')
|
|
|
|
self.name = kwargs.get('resource_name')
|
|
|
|
self.name = kwargs.get('resource_name')
|
|
|
|
self.namespace = kwargs.get('namespace')
|
|
|
|
self.namespace = kwargs.get('namespace')
|
|
|
@ -100,15 +99,10 @@ class KubernetesLookup(object):
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
if self.name:
|
|
|
|
if self.name:
|
|
|
|
self.mylog("Calling get_object()")
|
|
|
|
|
|
|
|
return self.get_object()
|
|
|
|
return self.get_object()
|
|
|
|
|
|
|
|
|
|
|
|
return self.list_objects()
|
|
|
|
return self.list_objects()
|
|
|
|
|
|
|
|
|
|
|
|
def mylog(self, msg):
|
|
|
|
|
|
|
|
with open('loggit.txt', 'a') as f:
|
|
|
|
|
|
|
|
f.write(msg + '\n')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_helper(self, api_version, kind):
|
|
|
|
def get_helper(self, api_version, kind):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
helper = KubernetesObjectHelper(api_version=api_version, kind=kind, debug=False)
|
|
|
|
helper = KubernetesObjectHelper(api_version=api_version, kind=kind, debug=False)
|
|
|
@ -144,7 +138,6 @@ class KubernetesLookup(object):
|
|
|
|
result = self.helper.get_object(self.name, self.namespace)
|
|
|
|
result = self.helper.get_object(self.name, self.namespace)
|
|
|
|
except KubernetesException as exc:
|
|
|
|
except KubernetesException as exc:
|
|
|
|
raise Exception('Failed to retrieve requested object: {0}'.format(exc.message))
|
|
|
|
raise Exception('Failed to retrieve requested object: {0}'.format(exc.message))
|
|
|
|
self.mylog("Got restult")
|
|
|
|
|
|
|
|
response = []
|
|
|
|
response = []
|
|
|
|
if result is not None:
|
|
|
|
if result is not None:
|
|
|
|
# Convert Datetime objects to ISO format
|
|
|
|
# Convert Datetime objects to ISO format
|
|
|
|