summaryrefslogtreecommitdiffstats
path: root/jenkins_jobs/utils.py
Commit message (Collapse)AuthorAgeFilesLines
* Auto-generated output from python-blackThanh Ha2019-09-091-13/+19
| | | | | | | | | Please review the following patch containing the code changes in the repo. This patch is a transition patch and is the auto-generated output of the python-black tool. Change-Id: I2d2de71da8a105fb62b561899ae78441ddab4032 Signed-off-by: Thanh Ha <zxiiro@gmail.com>
* Add retain_anchors config option.Vicky Chijwani2018-05-311-0/+3
| | | | | | | | | If set to True, YAML anchors can be referenced across files, allowing jobs to be composed from bits of YAML defined in separate files. False by default. Story: 2000338 Task: 2547 Change-Id: I034ce3bce0030093cb8d4266dabbdb06d96306d6
* user's input should not be interpretedIsaac Beckman2016-10-261-0/+1
| | | | | | | | | using python's "input" rather than "raw_input" raise exception since the user's input is interpreted. In python 3.x raw_input = input, so the interpertation bug only exists in python 2.x Change-Id: I28781a8742d6e03bc850fd0178f317474603a9d2
* Fix confirm() util true stateThanh Ha2016-09-201-1/+1
| | | | | | | | | | | | | | The confirm() util incorrectly returns true only when the answer is false. This patch reverses the logic so that it properly returns true when the user inputs a true statement. Include test case for delete-all command usage to accept or abort. Mocking the input builtin ensures that the behaviour resulting from the user inputting 'y' or 'n' will remain tested for delete-all. Change-Id: I742804a8efe7da8ca6aa70f20059d02758910deb Co-Authored-By: Darragh Bailey <dbailey@hpe.com> Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
* Finish removing code from jenkins_jobs.cmdWayne Warren2016-07-221-0/+5
| | | | | | | | | * Move behavior of jenkins_jobs.cmd.execute() into jenkins_jobs.cli.entry.JJBConfig.execute() * Delete jenkins_jobs/cmd.py * Fix up unit tests to deal with rearranged code. Change-Id: Ia0d3a062de16c4be10863372c753f4ba8480e620
* Use JJBConfig for arg/config initialization.Wayne Warren2016-07-191-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | * Create jenkins_jobs.config module with JJBConfig class. * Move DEFAULT_CONF from jenkins_jobs.cmd into jenkins_jobs.config * Move configuration initialization into JJBConfig * Create method, "do_magical_things" to handle arbitration between config file and arguments as well as setting default values for config file settings if it doesn't contain the expected keys. * Move JenkinsJobs.create_parser into its own module, jenkins_jobs.cli.parser, it can be used to provide default settings in the JJBConfig class when an argparse namespace object is not provided; this is primarily necessary because most of the original configuration initialization code relies on this being a namespace object (simple descendant of the object class). At this point JJBConfig isn't much more than an object-oriented version of the way configuration handling happened previously. Its current form, however, is more amenable to the ultimate goal of the 2.0 refactorings--namely, being able to pass a single config object around rather than breaking it up into apparently arbitrary settings necessary to instantiate the Builder class and its delegate objects. Change-Id: Ic0147e1dccbe620aaaba039a434e7cea6c670054
* Wrap file objects with codecs to handle unicodeDarragh Bailey2015-10-091-0/+35
Ensure file objects including stdin/stdout objects are wrapped using codecs to handle unicode translation to the selected encoding for input/output. Add tests to simulate different encodings for input/output and consequently fix the reading of input from stdin. Include test to trigger failure to encode a unicode valid character using 'ascii' encoding. Change-Id: I9a5c4c96d131873db0000377729b8b0a45aa470d