puppetlabs / puppet_operational_dashboards

Apache License 2.0
5 stars 22 forks source link

How to handle the toml-rb gem and TOML files in general #95

Open SimonHoenscheid opened 1 year ago

SimonHoenscheid commented 1 year ago

Use Case

currently this module installs the toml-rb gem, but the user can not decide

Describe the Solution You Would Like

One option would be to patch this module and the influxdb module it uses to do this An other option would be to use to_toml() function from stdlib, and get rid of the dependency: https://github.com/puppetlabs/puppetlabs-stdlib/blob/main/REFERENCE.md#to_toml (I would prefer this)

Describe Alternatives You've Considered

none

Additional Context

none

m0dular commented 1 year ago

Unfortunately stdlib doesn't have a from_toml function equivalent to toml-rb's load function, which we need for reading the config files from disk and comparing to the desired state. I know installing gems isn't the best option and we'd like to avoid it when possible, but I don't see a way around it currently.

The version can be specified in influxdb::profile::toml, but like you said it's not great when you have a proxy or airgap.

I guess if you are ok with not using SSL for InfluxDB and using Bolt, you could use the provision dashboard plan. That sort of gets around the gem issue because you can install it locally with Bolt, so it doesn't have to be installed on the target machine.

/opt/puppetlabs/bolt/bin/gem install --user-install toml-rb

I'll leave this open for now so people can leave comments and suggestions, but I think toml-rb will probably remain a requirement.

SimonHoenscheid commented 1 year ago

the missing from_toml (stdlib has load$DATAFORMAT) and parse$DATAFORMAT for this case. I will have a look at these and figure out if these are a good blueprint for a TOML implementation.

bastelfreak commented 1 year ago

https://github.com/voxpupuli/puppet-telegraf/pull/207 for telegraf we're switching to the stdlib implementation to get rid of toml.