Skip to content

Support multiple Jenkins instances in config file - #38

Merged
LD250 merged 4 commits into
LD250:masterfrom
radomirbosak:add-config-sections
Jun 4, 2017
Merged

LD250 merged 4 commits into
LD250:masterfrom
radomirbosak:add-config-sections

Conversation

@radomirbosak

Copy link
Copy Markdown
Contributor

This commit adds sections to the .jenkins-cli config file. The section
which should be used is specified with the -e or --environment. If no
environment is specified, the "DEFAULT" section is used.

Fixes #36

@radomirbosak
radomirbosak force-pushed the add-config-sections branch 2 times, most recently from e9147f3 to 677588d Compare June 1, 2017 14:58
This commit adds sections to the .jenkins-cli config file. The section
which should be used is specified with the -e or --environment. If no
environment is specified, the "DEFAULT" section is used.

Fixes LD250#36
@radomirbosak
radomirbosak force-pushed the add-config-sections branch from 677588d to bf78531 Compare June 1, 2017 15:04
@LD250

LD250 commented Jun 3, 2017

Copy link
Copy Markdown
Owner

Hello @radomirbosak .

I have two suggestions:

  1. Make error message more informative.
    For example, running jenkins -e LOCAL will give me No such environment: LOCAL error. This looks a bit confusing. I would change it for something like LOCAL section in .jencins-cli settings file is not found

  2. I think it is good practice to test cover new functionality. In this case TestCliFileUsing can be extended with new test case which tests that correct section is used when calling JenkinsCli.read_settings_from_file with respective environment.

@LD250
LD250 self-requested a review June 3, 2017 13:58
@radomirbosak

Copy link
Copy Markdown
Contributor Author

Hey @LD250 , I changed the error message and added a unit test for the new functionality.

The third commit fixes a unclosed-file warning revealed by the unit tests:

$ python3 -m unittest discover tests/
/home/rbosak/repos/jenkins-cli-python/jenkins_cli/cli.py:129: ResourceWarning: unclosed file <_io.TextIOWrapper name='/home/hupu/.jenkins-cli' mode='r' encoding='UTF-8'>
  config.readfp(open(filename, 'r'))

please take a look (PTAL)

@LD250 LD250 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything is good, thank you!

@LD250
LD250 merged commit 54d6477 into LD250:master Jun 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants