Skip to content
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

Merged
merged 5 commits into from
Nov 22, 2017
Merged

Use $service_name for service resource title. #1159

merged 5 commits into from
Nov 22, 2017

Conversation

fnoop
Copy link
Contributor

@fnoop fnoop commented Nov 21, 2017

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

@@ -150,7 +150,7 @@
$service_ensure = running,
$service_flags = undef,
$service_restart = undef,
$service_name = undef,
$service_name = "nginx",
Copy link
Member

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

Copy link
Contributor Author

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?

Copy link
Member

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.

Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done with e557db0

@@ -40,7 +40,7 @@
if $service_manage {
case $::osfamily {
'OpenBSD': {
service { 'nginx':
service { 'puppet_nginx':
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed, updated with 7e7dbf6

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.

Looks good. Let's see if Travis agrees :)

enable => $service_enable,
flags => $service_flags,
hasstatus => true,
hasrestart => true,
}
}
default: {
service { 'nginx':
service { $service_name:
ensure => $service_ensure_real,
name => $service_name,
Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops. ad41e15

@alexjfisher alexjfisher changed the title Rename service resource name from nginx to puppet_nginx #1158 Use $service_name for service resource title. Nov 21, 2017
@alexjfisher alexjfisher added the enhancement New feature or request label Nov 21, 2017
Copy link
Member

@alexjfisher alexjfisher left a 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

it { is_expected.to contain_service('nginx').with_name('nginx14') }
?

@fnoop
Copy link
Contributor Author

fnoop commented Nov 21, 2017

@alexjfisher Now the service name is dynamic, I don't know how to do that. Sorry, I don't know how tests work.

@ekohl
Copy link
Member

ekohl commented Nov 21, 2017

It should be it { is_expected.to contain_service('nginx14') }

@fnoop
Copy link
Contributor Author

fnoop commented Nov 22, 2017

Hurrah, travis passes now :)

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.

@alexjfisher want to have a last look?

@alexjfisher
Copy link
Member

@ekohl If I squash and merge, do you know what ends up in the commit message?

@ekohl
Copy link
Member

ekohl commented Nov 22, 2017

@alexjfisher Github shows a dialog when you squash where it prefills a commit message based on all the commits but you can edit it.

@alexjfisher alexjfisher merged commit 6a4657e into voxpupuli:master Nov 22, 2017
@alexjfisher
Copy link
Member

Thanks @fnoop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants