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

Cleanup how python modules are configured #821

Merged
merged 2 commits into from
Jun 25, 2018

Conversation

traylenator
Copy link
Contributor

@traylenator traylenator commented Jun 20, 2018

Convert templates for collectd::module::python to epp

Example

collectd::plugin::python::module{'example':
  config => [{'Verbose' => true,
              'Values'  => ['abc',def'],
              'Name     => 'My Name',
              'Limit    => 3.4
             },
            ],
  }
}

This will now render as

Import "example"
<Module "example">
  Verbose true
  Values "abc" "def"
  Name "My Name"
  Limit 3.4
</Module>

Specifying a hash value in the config paramater will now result in a type
failure. Previously it would add nonsense to the configuration file.
e.g

collectd::plugin::python::module{'example':
  config => [{'Values' => {'abc' => 'def'}}],
}

will now give a type error.

To specify a list of quoted strings use an array. Previously
the following could be used.

collectd::plugin::python::module{'example':
  config => [{'Values' => '"abc" "def"',
              'Name'   => '"My Name"',
            }],
}

to acheive the same result use

collectd::plugin::python::module{'example':
  config => [{'Values' => ['abc','def'],
              'Name'   => 'My Name',
            }],
}

to render

Import "example"
<Module "example">
  Values "abc" "def"
  Name "My Name"
</Module>

It is now possible to specify multiple instances of a single python
module by using collectd::plugin::python::module twice. e.g.

collectd::plugin::python::module{'exampleA':
  module => 'example',
  config => [{'Values' => 'abc'],}
}
collectd::plugin::python::module{'exampleB':
  module => 'example',
  config => [{'Values' => 'def'],}
}

Fixes #819

@@ -74,7 +74,7 @@
end
end

context ':ensure => present and configure elasticsearch module' do
context ':ensure => present and configure Elasticsearch module' do
Copy link
Contributor Author

Choose a reason for hiding this comment

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

change should not be there.

Convert templates for `collectd::module::python` to `epp`

Example

```puppet
collectd::plugin::python::module{'example':
  config => [{'Verbose' => true,
              'Values'  => ['abc',def'],
              'Name     => 'My Name',
              'Limit    => 3.4
             },
            ],
  }
}
```

This will now render as

```apache
Import "example"
<Module "example">
  Verbose true
  Values "abc" "def"
  Name "My Name"
  Limit 3.4
</Module>
```

Specifying a hash value in the `config` paramater will now result in a type
failure. Previously it would add nonsense to the configuration file.
e.g

```puppet
collectd::plugin::python::module{'example':
  config => [{'Values' => {'abc' => 'def'}}],
}
```
will now give a type error.

To specify a list of quoted strings use an array. Previously
the following could be used.

```puppet
collectd::plugin::python::module{'example':
  config => [{'Values' => '"abc" "def"',
              'Name'   => '"My Name"',
            }],
}
```

to acheive the same result use

```puppet
collectd::plugin::python::module{'example':
  config => [{'Values' => ['abc','def'],
              'Name'   => 'My Name',
            }],
}
```

to render

```apacheconf
Import "example"
<Module "example">
  Values "abc" "def"
  Name "My Name"
</Module>

It is now possible to specify multiple instances of single python
module by using `collectd::plugin::python::module` twice. e.g.

```puppet
collectd::plugin::python::module{'exampleA':
  module => 'example,
  config => [{'Values' => 'abc'],}
}
collectd::plugin::python::module{'exampleB':
  module => 'example,
  config => [{'Values' => 'def'],}
}
```

Fixes voxpupuli#819
@@ -79,7 +79,7 @@

concat::fragment { 'collectd_plugin_python_conf_header':
order => '00',
content => template('collectd/plugin/python/header.conf.erb'),
content => epp('collectd/plugin/python/header.conf'),
Copy link
Member

Choose a reason for hiding this comment

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

Please make the extension .epp

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's weird how it even works without. .epp added to that and other two places now.

@bastelfreak
Copy link
Member

thanks @traylenator !

@bastelfreak bastelfreak merged commit e1f29e9 into voxpupuli:master Jun 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants