Skip to content
This repository was archived by the owner on Nov 24, 2021. It is now read-only.

Fixes #21128 - expand certs_tar in pre_validations #542

Merged
merged 1 commit into from
Oct 3, 2017

Conversation

iNecas
Copy link
Member

@iNecas iNecas commented Sep 27, 2017

This allows passing the certs_tar as relative path.

Also, fix the check on exitence of the file, as the certs_tar is now
in different module.

This allows passing the certs_tar as relative path.

Also, fix the check on exitence of the file, as the certs_tar is now
in different module.
@theforeman-bot
Copy link

Issues: #21128

@iNecas
Copy link
Member Author

iNecas commented Sep 27, 2017

This should work both with capsule-certs-generate as well as when passing the --foreman-proxy-content-certs-tar to the installer. We check on the exitence of the file only when we actually are about to deploy the certs: checking otherwise makes no sense, as if deploy is false, we are probably just generating the tar

Copy link
Member

@ekohl ekohl left a comment

Choose a reason for hiding this comment

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

Overall it looks like a good fix.

if param('capsule', 'certs_tar') && (certs_tar = param('capsule', 'certs_tar').value)
unless File.file?(certs_tar)
error "The certs tar file generated by the server is not present at #{certs_tar}, exiting."
certs_tar = param('foreman_proxy_certs', 'certs_tar') ||
Copy link
Member

Choose a reason for hiding this comment

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

The module foreman_proxy_certs doesn't exist. Did you mean foreman_proxy_content? This also looks like a bonus fix of previously dead code due to the module rename so 👍

Copy link
Member Author

Choose a reason for hiding this comment

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

In capsule certs generated, there is mapping defined https://github.com/Katello/katello-installer/blob/master/bin/foreman-proxy-certs-generate#L63 therefor it got here as well. Perhaps @ehelms knows why the mapping is there?

Copy link
Member

Choose a reason for hiding this comment

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

Looking at it, I can't figure a real reason other than just typoing it during conversion away from capsule.

Copy link
Member

Choose a reason for hiding this comment

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

I can imagine that in a pure proxy context you use that instead of certs to set the options. Including certs implies that you also create a CA which you don't want on your proxy.

@ehelms
Copy link
Member

ehelms commented Sep 27, 2017

You can already pass certs_tar as a relative path for the record [1]. The puppet type is simply 'string' which means no validation is done on pathing. This check adds some robustness to try to ensure that the file does exist at the absolute path and thus has some validity but wanted to clarify.

[1] https://github.com/Katello/puppet-certs/blob/master/manifests/foreman_proxy_content.pp#L18

param('foreman_proxy_content', 'certs_tar')

if certs_tar.value
certs_tar.value = File.expand_path(certs_tar.value)
Copy link
Member

Choose a reason for hiding this comment

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

Do you know if expand_path handles ~ and thus also solves that issue we've avoided through docs?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, it handles ~ as well

@iNecas
Copy link
Member Author

iNecas commented Sep 27, 2017

The test failures don't seem related

@ekohl
Copy link
Member

ekohl commented Sep 27, 2017

The test failures don't seem related

voxpupuli/librarian#5 should fix that - it's an incompatibility with git 2.14.0 which Travis has installed.

@iNecas
Copy link
Member Author

iNecas commented Oct 3, 2017

Anything left on me?

@ekohl ekohl merged commit d3dd419 into Katello:master Oct 3, 2017
@ekohl
Copy link
Member

ekohl commented Oct 3, 2017

Nothing left, thanks!

ehelms pushed a commit that referenced this pull request Oct 20, 2017
This allows passing the certs_tar as relative path.

Also, fix the check on existence of the file, as the certs_tar is now
in different module.

(cherry picked from commit d3dd419)
zjhuntin pushed a commit to zjhuntin/katello-installer that referenced this pull request Oct 30, 2018
* Fixes #22517 - Resolvables compatible with option sources

* Resolvables refactoring

* Whitespace fixes

* Removing unused method
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants