Skip to content

Conversation

@bernardoVale
Copy link

For folks like me, that still has to deal with self-signed certificates :)

This fixes the issue #26.


# Default constants to parse booleans from .jenkins-cli
TRUE = ['yes', 'Yes', 'YES', 'True', 'true', 'TRUE', '1']
FALSE = ['no', 'No', 'NO', 'False', 'false', 'FALSE', '0']
Copy link
Owner

Choose a reason for hiding this comment

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

Looks like FALSE is not used anywhere. I think we do not need it.

Copy link
Author

Choose a reason for hiding this comment

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

Ok, I agree with you.



# Default constants to parse booleans from .jenkins-cli
TRUE = ['yes', 'Yes', 'YES', 'True', 'true', 'TRUE', '1']
Copy link
Owner

Choose a reason for hiding this comment

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

I think if ignore_ssl= option is in .jencins-cli file, that means that we do want to ignore ssl errors. So I think we do not need TRUE constant as well.

Copy link
Author

Choose a reason for hiding this comment

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

Well, I think it will be very weird if someone configures this property like this: ignore_ssl=False and the application continue ignoring SSL errors.

That's why I thought it would be a good idea to configure a list with all acceptable strings.

ignore_ssl= also seems strange to me. What do you think?

Copy link
Owner

Choose a reason for hiding this comment

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

I agree that ignore_ssl=False may looks a bit strange. But the list with all acceptable strings looks strange also.
Maybe it will be enough to define behavior in help section?

Something like:
"You can set ignore_ssl in settings file. Any value will be treated as True unless it equals 0"
or
"You can set ignore_ssl=1 in settings file if you want to ignore ssl erros. All other values will be treated as False"

We need to document this option anyway and its hardy possible to find all acceptable strings (for example we can also add 'y' and 'Y')

What do you think?

Copy link
Author

Choose a reason for hiding this comment

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

I agree, any case scenario this should be documented on both README.md and --help.

We could document that the user should set ignore_ssl=yes and all other cases will be treated as False and still have the list.

If we decide to accept only one option the comparison will be pretty much the same:

List:

cls.ignore_ssl = ignore_ssl or settings_dict.get('ignore_ssl', 'False') in TRUE

Single accepted pattern:

cls.ignore_ssl = ignore_ssl or settings_dict.get('ignore_ssl', 'False') == '1'

BTW, I was inspired by ansible when I wrote this list. They pretty much have the same problem, reading config and transforming what it seems to be boolean into python bool.

@LD250
Copy link
Owner

LD250 commented Apr 23, 2017

Hello @bernardoVale thank you for the PR.
Travis has reported some issues, could you please fix them before merge?

@bernardoVale
Copy link
Author

Hey @LD250, I've fixed the flake8 issue, but the test aren't failing because of my new code.

I've just checked using your master branch, check the error:

running test
Searching for pbr>=2.0.0
Reading https://pypi.python.org/simple/pbr/
Download error on https://pypi.python.org/simple/pbr/: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749) -- Some packages may not be found!
Couldn't retrieve index page for 'pbr'
Scanning index of all packages (this may take a while)
Reading https://pypi.python.org/simple/
Download error on https://pypi.python.org/simple/: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749) -- Some packages may not be found!
No local packages or working download links found for pbr>=2.0.0
error: Could not find suitable distribution for Requirement.parse('pbr>=2.0.0')

It's an ssl error while downloading pbr dependency, what an irony haha.

@LD250
Copy link
Owner

LD250 commented Apr 23, 2017

I've just checked using your master branch, check the error:

I will check this today later

@LD250
Copy link
Owner

LD250 commented May 12, 2017

@bernardoVale I have merged Travis build fix to master branch. I also removed python3.5 from .travis.yml. #29

@djetelina
Copy link

Merging this would be appreciated, for now I hardcoded the context creation into run_command and it works :)

@LD250
Copy link
Owner

LD250 commented Aug 30, 2017

PR is a bit outdated. Conflicts should be resolved before merge.

@bernardoVale
Copy link
Author

@LD250 I will rebase master.

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.

3 participants