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

Add enable and active parameters to unit_file #69

Merged
merged 3 commits into from
Mar 15, 2018

Conversation

jcharaoui
Copy link
Contributor

Allows the deployed units to be enabled and/or started by the module. By default it will leave the units unmanaged.

This is an attempt to supersede PR #55 for which the original submitter appears to have lost interest.

Allows the deployed units to be enabled and/or started by the module.
By default it will leave the units unmanaged.
@@ -57,4 +65,14 @@
mode => '0444',
notify => Class['systemd::systemctl::daemon_reload'],
}

if $enable != undef or $active != undef {
Copy link
Member

Choose a reason for hiding this comment

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

Previously it was mentioned there are other unit files like mount or timer. Can service handle those as well or should we use a regex like $name =~ /^.+\.service$/ in this if as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The service native resource can definitely handle other types of unit files, as long as the provider is set as systemd.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It should be noted, however, that unless a unit type suffix is used as the resource name (eg. .mount or .timer, it will default to a service unit type.

@ekohl
Copy link
Member

ekohl commented Mar 12, 2018

It'd be good if there was a testcase for this.

@jcharaoui
Copy link
Contributor Author

I wish I could write this testcase myself but I don't know enough about puppet module tests to do so myself, at his time.

@bastelfreak bastelfreak added enhancement New feature or request needs-tests labels Mar 13, 2018
@bastelfreak
Copy link
Member

@jcharaoui have you checked the existing tests in https://github.com/camptocamp/puppet-systemd/blob/master/spec/classes/init_spec.rb ? Is that something that helps you? If you've any questions about writing tests, Puppet, or rspec-puppet (the unit testing framework) feel ree to join the IRC channel #voxpupuli on freenode from the Puppet Community. We're happy to help out.

@bastelfreak
Copy link
Member

Thanks for the tests @jcharaoui !

@bastelfreak bastelfreak merged commit df78e60 into voxpupuli:master Mar 15, 2018
@jcharaoui jcharaoui deleted the unit_service branch March 15, 2018 16:27
op-ct pushed a commit to op-ct/puppet-systemd that referenced this pull request Jun 17, 2022
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.

3 participants