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

docker::run: Add service_provider param to override OS detection #86

Closed

Conversation

jameslikeslinux
Copy link
Contributor

I know support for Gentoo in this module was dropped when it moved into the puppetlabs space. That said, it is still the easiest way to get Docker up and running on Gentoo with just a few extra parameters:

class { 'docker':
  docker_ce_package_name     => 'app-emulation/docker',
  service_config             => '/etc/conf.d/docker',
  service_config_template    => 'docker/etc/sysconfig/docker.systemd.erb',
  service_overrides_template => 'mine/docker/systemd-overrides.conf.erb',
  service_provider           => 'systemd',
}

where the mine/docker/systemd-overrides.conf.erb template contains:

[Service]
EnvironmentFile=-/etc/conf.d/docker
ExecStart=
ExecStart=/usr/bin/dockerd $OPTIONS

Unfortunately, the docker::run type detects that it is running on Gentoo and sets things up for OpenRC. Gentoo has first class support for systemd and I'd like to be able to tell the run type to use systemd, just as I do with Class[docker] via the service_provider parameter.

This pull request adds a service_provider parameter to the docker::run type which can be set to override the operating system detection. It can be set to systemd to enable systemd support. If it is set to anything else, or it is unset (the default), then the type falls back to the OS detection behavior that was there before.

The default behavior of the type is unchanged.

I have added rspec tests to validate this behavior.

This pull request also contains a couple of trivial variable definitions in default cases that were left undefined on non-RedHat and Debian systems.

Gentoo supports both OpenRC and systemd, and there is no good way to
detect what is being used.  So, like the `docker` class, this adds a
`service_provider` parameter to the `docker::run` type to override the
default selection determined by OS family and version.

Other minor fixes have been added to set missing variables when running
under a non-Debian or non-RedHat operating system.
@davejrt
Copy link
Contributor

davejrt commented Jan 2, 2018

There is some planned work in the pipeline the remove a lot of the existing logic referring to other OS. I'd like to have that work completed before we add additional functionality now that may create more tech debt.

When the ticket makes it into the sprint I'll make sure the work you've done here is taken into consideration. Thanks for your contribution. Feel free to grab me on the puppet community slack if you want to discuss further.

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

Successfully merging this pull request may close these issues.

2 participants