-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Accept Sensitive for Secrets #436
base: master
Are you sure you want to change the base?
Accept Sensitive for Secrets #436
Conversation
Related: theforeman/puppet-candlepin#210 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if this would need to require a sufficiently recent version of the candlepin module in metadata.json
. It certainly depends on it so I won't merge this until the other PR has been.
4a82b0f
to
5b6afac
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also add a unit test to ensure it works end to end?
I'm currently looking into a failure to parse Variant[
which I don't understand (https://community.theforeman.org/t/foreman-installer-develop-package-release-1015-failed/26627) so I'm first going to investigate that. It could be unrelated but then you at least know where I'm at.
The good news is that that failure is unrelated but the bad news is that it looks like something else broke our CI. |
Try pinning |
I'd like to see where puppetlabs/puppet#8849 goes first. |
5b6afac
to
7567313
Compare
@@ -50,7 +50,7 @@ | |||
Optional[Stdlib::Port] $candlepin_db_port = undef, | |||
String $candlepin_db_name = 'candlepin', | |||
String $candlepin_db_user = 'candlepin', | |||
Optional[String] $candlepin_db_password = undef, | |||
Optional[Variant[Sensitive[String], String]] $candlepin_db_password = undef, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found with puppet-foreman testing that this wouldn't work well with our installer. It writes out all the answers so you end up with Sensitive[Undef]
, which isn't accepted here.
So what you end with in the installer answers file is:
katello:
candlepin_db_password:
I think this translates to Hiera as:
katello::candlepin_db_password:
So that ends up sending undef
via Hiera. If you add a conversion to sensitive in Hiera using lookup_options, this ends up as Sensitive[Undef]
.
Optional[Variant[Sensitive[String], String]] $candlepin_db_password = undef, | |
Variant[Sensitive[Optional[String]], Optional[String]] $db_password = undef, |
This would then also need to be reflected in all other types.
I merged theforeman/kafo#345, will release it shortly. I'm also considering a solution where we add the lookup option and use this option:
Optional[Variant[Sensitive[String], String]] $candlepin_db_password = undef, | |
Sensitive[Optional[String]] $candlepin_db_password = sensitive(undef), |
That would be a lot more straight forward. It may be breaking to users who pass in arguments directly from Puppet, but we can look at that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no Knowledge, how the Installer-Answer-File works, but Hiera does not translate
katello:
candlepin_db_password:
to katello::candlepin_db_password
. Instead what Hiera does here, is: Lookup a Hash named katello
, find the Hash named katello
, which turns out to have a Key named candlepin_db_password
.
Isn't it possible to state an empty String ""
instead of "nothing"
katello:
candlepin_db_password: ""
in the Installer-Answer-File?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really. What the installer does is that it extracts the default value from Puppet and stores that. Thinking more about it, other code would probably also fail, like if $candlepin_db_password {}
is "false" with undef
but perhaps Sensitive[Undef]
may not.
I wonder if this is a more fundamental problem in Puppet and the lookup option may provide to only convert it if it isn't undef. Perhaps we need a conversion function that essentially is to_optional_sensitive(Optional[Any]) -> Optional[Sensitive[Any]])
(compared to sensitive(Any) -> Sensitive[Any]
). Does that make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this totally makes Sense.
I created an Issue in the Hiera-Board: https://tickets.puppetlabs.com/browse/HI-628
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! In theforeman/puppet-foreman#1018 we had a less structured discussion but I think I now understand the problem properly and I'm an issue there is helpful moving it forward. Thanks for distilling it down to the minimal problem statement.
7567313
to
9345737
Compare
9345737
to
c143a4d
Compare
c143a4d
to
091968e
Compare
091968e
to
7ca6dc1
Compare
7ca6dc1
to
93f2265
Compare
93f2265
to
3fb4791
Compare
3fb4791
to
47741f4
Compare
47741f4
to
ec7aca5
Compare
ec7aca5
to
a532555
Compare
No description provided.