Closed souravchaterjee closed 5 years ago
Parameters must be a dict and not a string. What you are passing is a string and function expects dict.
Thanks, can we have a full reference document for available functions with examples please? Will reduce issues getting logged.
On Tue, Nov 19, 2019 at 18:37 Aleksey Maksimov notifications@github.com wrote:
Parameters must be a dict and not a string. What you are passing is a string and function expects dict.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/pycontribs/jenkinsapi/issues/751?email_source=notifications&email_token=AGDSB2VVY4ULYX3653Y6ASTQUPQH3A5CNFSM4JPCNIV2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEOD6DY#issuecomment-555499279, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGDSB2TM2GDBQK76SMUVADTQUPQH3ANCNFSM4JPCNIVQ .
-- Warm Regards, Sourav Chaterjee
You're more than welcome to contribute to documentation. I will gladly accept pull request.
Sure Aleksey, will add documentation for all functions which I can work with. For now it seems Server.build_job(job, parameters=**parameters) is not the proper function to call.
On Tue, Nov 19, 2019 at 7:32 PM Aleksey Maksimov notifications@github.com wrote:
You're more than welcome to contribute to documentation. I will gladly accept pull request.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/pycontribs/jenkinsapi/issues/751?email_source=notifications&email_token=AGDSB2QHGP4T5ANONFZ6AH3QUPWWNA5CNFSM4JPCNIV2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEOJFUQ#issuecomment-555520722, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGDSB2S24BCVZWOQ3WPU6Q3QUPWWNANCNFSM4JPCNIVQ .
-- Warm Regards, Sourav Chaterjee LetsRISE.org.in http://letsrise.org.in/ https://www.facebook.com/letsRISE.org.in Bhavishya - Bless our children with a home!
ISSUE TYPE
Jenkinsapi VERSION
Name Version Build Channel
jenkinsapi 0.3.9 pypi_0 pypi
Jenkins VERSION
2.129
SUMMARY
Calling build_job with parameters, but failing as below:
export PARAMS="{'name': 'PRODUCT', 'value': 'CRM'}, {'name': 'EMAIL', 'value': 'xxxx@xxxx.com'}"
build_job(PLAB_SSO_CHECK, $PARAMS) Traceback (most recent call last): File "test.py", line 10, in
JB.run_job(jenkins_url, username, password, job, parameter)
File "/infra/basic-chatbot/UTILS/JENKINS/jboot_handling.py", line 23, in run_job
server.build_job(job,parameter)
File "/infra/anaconda3/envs/infracomcast/lib/python3.6/site-packages/jenkinsapi/jenkins.py", line 185, in build_job
self[jobname].invoke(build_params=params or {})
File "/infra/anaconda3/envs/infracomcast/lib/python3.6/site-packages/jenkinsapi/job.py", line 188, in invoke
if build_params else {} # Via POSTed JSON
AttributeError: 'str' object has no attribute 'items'
EXPECTED RESULTS
ACTUAL RESULTS
possible namespace for /infra/anaconda3/envs/infracomcast/lib/python3.6/site-packages/mpl_toolkits
import 'pkg_resources' # <_frozen_importlib_external.SourceFileLoader object at 0x7fffef355b38> import 'jenkinsapi' # <_frozen_importlib_external.SourceFileLoader object at 0x7ffff0920550> import 'jboot_handling' # <_frozen_importlib_external.SourceFileLoader object at 0x7ffff09202b0> Traceback (most recent call last): File "test.py", line 10, in
JB.run_job(jenkins_url, username, password, job, parameter)
File "/infra/basic-chatbot/UTILS/JENKINS/jboot_handling.py", line 23, in run_job
server.build_job(job,parameter)
File "/infra/anaconda3/envs/infracomcast/lib/python3.6/site-packages/jenkinsapi/jenkins.py", line 185, in build_job
self[jobname].invoke(build_params=params or {})
File "/infra/anaconda3/envs/infracomcast/lib/python3.6/site-packages/jenkinsapi/job.py", line 188, in invoke
if build_params else {} # Via POSTed JSON
AttributeError: 'str' object has no attribute 'items'
------ CODE FUNCTION------- export PARAMS="{'name': 'PRODUCT', 'value': 'CRM'}, {'name': 'EMAIL', 'value': 'xxxxx@xxxx.com'}" python -vvvv test.py http://xxxx xxxx xxxx EXAMPLE_JOB $PARAMS
----------------test.py---------------------
import sys import jboot_handling as JB jenkins_url =sys.argv[1] username = sys.argv[2] password = sys.argv[3] job = sys.argv[4] parameter = sys.argv[5]
JB.run_job(jenkins_url, username, password, job, parameter)
from jenkinsapi.jenkins import Jenkins import sys
def run_job(jenkins_url,username,password,job,parameter): server = Jenkins(jenkins_url, username, password)
job = PLAB_SSO_CHECK