passign authorization header also for task registration
This commit is contained in:
parent
1a85ae9f8d
commit
be37768e00
|
@ -50,7 +50,7 @@ class PyExec():
|
|||
logging.warning("Skipping plugin %s %s", path, err)
|
||||
continue
|
||||
|
||||
PyExecPlugin.registerTaskDefinitions(self.server)
|
||||
PyExecPlugin.registerTaskDefinitions(self.server, self.auth)
|
||||
|
||||
def start(self):
|
||||
self.logger.info("Started PyExec with plugins: %s", PyExecPlugin.getPluginNames())
|
||||
|
|
|
@ -27,7 +27,7 @@ class PyExecPlugins(type):
|
|||
def getAlias(cls, name):
|
||||
return cls.alias.get(name)
|
||||
|
||||
def registerTaskDefinitions(cls, server):
|
||||
def registerTaskDefinitions(cls, server, auth):
|
||||
url = server + "/metadata/taskdefs"
|
||||
#pyexec generic taskdefinition
|
||||
taskdefs = [
|
||||
|
@ -47,6 +47,8 @@ class PyExecPlugins(type):
|
|||
#Post all new (or not) task definitions to orchestrator
|
||||
logging.getLogger("pyexec").debug("Recording task definitions %s", taskdefs)
|
||||
headers = {'Content-Type': 'application/json'}
|
||||
if auth != None:
|
||||
headers['Authorization'] = 'Basic ' + auth
|
||||
try:
|
||||
response = requests.request("POST", url, headers=headers, data=json.dumps(taskdefs))
|
||||
except Exception as e:
|
||||
|
|
Loading…
Reference in New Issue