Hi,
This very simple code fails :
==================================================
from pyrundeck import Rundeck
def main:
rundeck = Rundeck(
'https://rundeckurl',
username = '<user>',
password = '<password>',
)
==================================================
with this stacktrace :
==================================================
Traceback (most recent call last):
File "./rundeck_check_ldap.py", line 44, in <module>
sys.exit(main(sys.argv))
File "./rundeck_check_ldap.py", line 35, in main
api_version = 20,
File "/usr/lib/python3.6/site-packages/pyrundeck/rundeck.py",
line 39, in __init__
self.auth_cookie = self.auth()
File "/usr/lib/python3.6/site-packages/pyrundeck/rundeck.py",
line 52, in auth
return r.cookies["JSESSIONID"]
File
"/usr/local/lib/python3.6/site-packages/requests/cookies.py",
line 328, in __getitem__
return self._find_no_duplicates(name)
File
"/usr/local/lib/python3.6/site-packages/requests/cookies.py",
line 399, in _find_no_duplicates
raise KeyError('name=%r, domain=%r, path=%r' % (name,
domain, path))
KeyError: "name='JSESSIONID', domain=None, path=None"
==================================================
I know that a change occurred as of 4.8
But as the new maintainer of pyrundeck, I have no idea on how to fix this.
Any idea poeple ?
Thanks,
Regards,
Xavier
-- Xavier Humbert CRT Supervision et Exploitation de Niveau 1 Direction des Services d'Information du Grand Est Rectorat de l'Académie de Nancy-Metz Ministère de l'Éducation Nationale et de la Jeunesse 03 83 86 27 39
PS : the very same problem occurs with Perl code
Xavier
Hi, probably pyrundeck needs an update. Anyway, a good “workaround” is to use a python script based on the request module. Something like:
import requests # host definition rdeck_instance = "localhost" rdeck_port = "4440" rdeck_api = "45" rdeck_username = "admin" rdeck_password = "admin" rdeck_job_id = "279fe1b1-07b7-4272-9512-6eae512bb9a1" rdeck_option_name = "opt1" rdeck_option_value = "world!!" # connect to instance s = requests.Session() r = s.post("http://" + rdeck_instance + ":" + rdeck_port +"/j_security_check", data={ "j_username": rdeck_username, "j_password": rdeck_password }) r.status_code r.url # print data (for debug) print ('######################') print (r.status_code) print (r.url) print ('######################') r = s.post("http://" + rdeck_instance + ":" + rdeck_port +"/api/" + rdeck_api + "/job/" + rdeck_job_id + "/run", data={ "argString": "-%s %s" %(rdeck_option_name, rdeck_option_value) }, headers = {'Accept': 'application/json'}) # json response print(r.json())Greetings!
Hi, Reiner,
Thanks for the tip, and yes I'm working on pyrundeck updates.
Regards,
Xavier
--
You received this message because you are subscribed to the Google Groups "rundeck-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rundeck-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rundeck-discuss/250a6491-9b3a-4f44-99b2-7b555db8096an%40googlegroups.com.
-- Xavier Humbert CRT Supervision et Exploitation de Niveau 1 Direction des Services d'Information du Grand Est Rectorat de l'Académie de Nancy-Metz Ministère de l'Éducation Nationale et de la Jeunesse 03 83 86 27 39