-
Notifications
You must be signed in to change notification settings - Fork 136
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
Add support for the Certbot Gandi plugin #295
base: master
Are you sure you want to change the base?
Conversation
manifests/plugin/dns_gandi.pp
Outdated
if $package_provider { | ||
package { $package_name: | ||
ensure => installed, | ||
provider => $package_provider, | ||
} | ||
} | ||
else { | ||
package { $package_name: | ||
ensure => installed, | ||
} | ||
} |
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.
You can just pass undef
along:
if $package_provider { | |
package { $package_name: | |
ensure => installed, | |
provider => $package_provider, | |
} | |
} | |
else { | |
package { $package_name: | |
ensure => installed, | |
} | |
} | |
package { $package_name: | |
ensure => installed, | |
provider => $package_provider, | |
} |
manifests/plugin/dns_gandi.pp
Outdated
if $api_key { | ||
$ini_vars = { | ||
'certbot_plugin_gandi:dns_api_key' => $api_key, | ||
} | ||
} else { | ||
fail('api_key not provided for certbot dns gandi plugin.') | ||
} |
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.
The data type guarantees it's set
if $api_key { | |
$ini_vars = { | |
'certbot_plugin_gandi:dns_api_key' => $api_key, | |
} | |
} else { | |
fail('api_key not provided for certbot dns gandi plugin.') | |
} | |
$ini_vars = { | |
'certbot_plugin_gandi:dns_api_key' => $api_key, | |
} |
@cible Is this ready for review? The pull request is currently marked as a draft. |
manifests/plugin/dns_gandi.pp
Outdated
class letsencrypt::plugin::dns_gandi ( | ||
String[1] $api_key, | ||
String[1] $package_name, | ||
Optional[String[1]] $package_provider = 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.
This is an unused parameter. Shouldn't it be passed to the package
resource?
Co-authored-by: Ewoud Kohl van Wijngaarden <[email protected]>
|
||
it do | ||
if package_name.nil? | ||
is_expected.not_to compile |
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.
A better way is to test for the error:
is_expected.not_to compile | |
is_expected.to compile.and_raise_error(/A Matcher For The Error/) |
PUPPET | ||
end | ||
|
||
it { is_expected.not_to compile.with_all_deps } |
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.
Here too it's better to compile and test for a specific error
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.
For this one, the module won't work with an empty api_key and I don't know how to handle the error:
13) letsencrypt::certonly on fedora-36-x86_64 based operating systems with dns-gandi plugin without api_key is expected to fail to compile and raise an error matching /\/expects a value for parameter 'api_key'\//
Failure/Error: it { is_expected.to compile.and_raise_error(%r{/expects a value for parameter 'api_key'/}) }
error during compilation: Evaluation Error: Error while evaluating a Resource Statement, Class[Letsencrypt::Plugin::Dns_gandi]: expects a value for parameter 'api_key' (line: 6, column: 11
it { is_expected.to compile.and_raise_error(%r{/expects a value for parameter 'api_key'/}) }
is not correct?
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.
The /
is redundant. In Ruby you can define a regex as /my regex/
or %r{my regex}
but %r{/my regex/}
means you expect /
in the output. This is useful if you want to test /var/lib is empty
is in the error. Compare %r{/var/lib is empty}
to /\/var\/lib is empty/
.
Co-authored-by: Ewoud Kohl van Wijngaarden <[email protected]>
It seem ok for me. Sorry for being so slow and bad with ruby. Did I have to do something else? rebase? |
@cible yes, this needs a rebase. I think we can merge if afterwards 👍 |
Pull Request (PR) description
Adding feature support for the certbot-plugin-gandi created by @obynio
The plugin use the Production API key.
This Pull Request (PR) fixes the following issues
N/A