-
-
Notifications
You must be signed in to change notification settings - Fork 883
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
Use $service_name for service resource title. #1159
Conversation
manifests/init.pp
Outdated
@@ -150,7 +150,7 @@ | |||
$service_ensure = running, | |||
$service_flags = undef, | |||
$service_restart = undef, | |||
$service_name = undef, | |||
$service_name = "nginx", |
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 should be in single quotes
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.
Why is that - for security, to stop string evaluation?
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.
It's a lint rule we have. Strings without variables should be in single quotes. I think it was copied from ruby.
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.
If you can fix this then the build will pass and I think it's good to go.
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.
Done with e557db0
manifests/service.pp
Outdated
@@ -40,7 +40,7 @@ | |||
if $service_manage { | |||
case $::osfamily { | |||
'OpenBSD': { | |||
service { 'nginx': | |||
service { 'puppet_nginx': |
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 we should just use $service_name
and drop the name => $service_name
.
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.
Same thing as name defaults to the resource name, just more explicit. Would be tidier that way, I agree.
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.
IMHO the biggest benefit is that there's no risk of overlapping resource names for different services.
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.
Agreed, updated with 7e7dbf6
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.
Looks good. Let's see if Travis agrees :)
manifests/service.pp
Outdated
enable => $service_enable, | ||
flags => $service_flags, | ||
hasstatus => true, | ||
hasrestart => true, | ||
} | ||
} | ||
default: { | ||
service { 'nginx': | ||
service { $service_name: | ||
ensure => $service_ensure_real, | ||
name => $service_name, |
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.
Oh, and this line can be removed too
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.
Oops. ad41e15
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.
@fnoop Could you update this test
puppet-nginx/spec/classes/nginx_spec.rb
Line 214 in f22fee3
it { is_expected.to contain_service('nginx').with_name('nginx14') } |
@alexjfisher Now the service name is dynamic, I don't know how to do that. Sorry, I don't know how tests work. |
It should be |
Hurrah, travis passes now :) |
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.
@alexjfisher want to have a last look?
@ekohl If I squash and merge, do you know what ends up in the commit message? |
@alexjfisher Github shows a dialog when you squash where it prefills a commit message based on all the commits but you can edit it. |
Thanks @fnoop |
This allows to specify a custom service name such as 'custom-nginx', while also separately controlling the system nginx service outside of puppet-nginx module.
Closes #1158