简体   繁体   中英

Python-Jenkins raises on create_job if the job name contains spaces

I am developing some automation with Jenkins, and I'm trying to create jobs with a simple script.

python-jenkins==0.2.1

The very odd problem I'm facing, is that i get a very generic

jenkins.JenkinsException: create[job name] failed

and when I check on Jenkins, the job is actually created, the configuration is ok, but the name stops at the very first space. If the job name doesn't contain any space, no error is raised.

Any of you has experience with this? Or a suggestion on what it could be? Thanks!

Presumably the library is calling a command line tool and not properly escaping spaces in the arguments. I'd report it as a bug. In the meantime, assuming your job name doesn't have any apostrophes in it, you can try passing the name with apostrophes around it, eg 'name with spaces in' , or else use pipes.quote or shlex.quote on the name before passing it.

Since the job names translate to path names, you face the same issues with space in your jobnames, that you are facing with path names. One of the easiest ways to fix this issue is to not allow spaces (and all other characters that will pose issues in filenames).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM