Skip to content

Allow disabling management of /etc/sysconfig/docker-storage-setup #1043

@SteenSchutt

Description

@SteenSchutt

Use Case

Currently it is possible to disable management of almost all configuration files by setting some parameters to false, but this is not the case for /etc/sysconfig/docker-storage-setup on RHEL. I would like to disable management of all configuration files so I can do it myself in another module, but this is the only one that cannot be disabled.

Describe the Solution You Would Like

Either of the following:

  1. Wrap the File[$storage_setup_file] definition in service.pp in an if-statement (or amend the existing one) to only declare the class if $storage config is truthy.
  2. Update the type definition for $docker::service::storage_setup_file to Optional[Variant[String,Bool]] so it can be set to false, and do the same as above but for that variable instead. This is an identical solution to the one used for $storage_config and $service_config etc.

I personally prefer the first solution since I don't think it makes sense to configure storage-setup if you're not configuring storage, and I want to be able to disable management of config files by setting the fewest parameters possible.

Describe Alternatives You've Considered

The config file generated by default is empty, so the only alternative is to leave it alone. The file cannot be managed outside of this class, as it stands.

Additional Context

I am declaring the docker class using the following parameters:

class { 'docker':
  manage_package => false,
  manage_service => false,
  service_provider => "",
  service_overrides_template => false,
  storage_config => false,
  service_config => false,
}

Doing so (versus the previous state without the docker class declared) results in the following changes:

Notice: Requesting catalog from puppet:8140 (172.18.0.3)
Notice: Catalog compiled by puppet
Info: Applying configuration version '1769407202'
Notice: /Stage[main]/Docker::Service/File[/etc/sysconfig/docker-storage-setup]/ensure: defined content as '{sha256}2db9dfcd7cc9ca701efe9fddcf75df83215f3127acb3bf36717e6d956df32175' (noop) (corrective)
Notice: Class[Docker::Service]: Would have triggered 'refresh' from 1 event
Notice: Class[Docker]: Would have triggered 'refresh' from 1 event
Notice: Stage[main]: Would have triggered 'refresh' from 1 event
Notice: Applied catalog in 0.40 seconds

This is the file declaration in question:

if $facts['os']['family'] == 'RedHat' {
file { $storage_setup_file:
ensure => file,
force => true,
content => epp('docker/etc/sysconfig/docker-storage-setup.epp', $docker_storage_setup_parameters),
before => $_manage_service,
notify => $_manage_service,
}
}

From what I can tell there are no dependencies on this file being declared, so wrapping it in a condition should not be an issue (It is already conditional based on operating system).

I'll be happy to make either change myself if you approve.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions