smoeding / puppet-debconf Goto Github PK
View Code? Open in Web Editor NEWManage entries in the Debian debconf database with Puppet
License: BSD 2-Clause "Simplified" License
Manage entries in the Debian debconf database with Puppet
License: BSD 2-Clause "Simplified" License
metadata.json puppetforge lists version 2.2.1 but no github release tag is available
Under Ubuntu 16.04 debconf-utils package isn't installed automatically.
This module doesn't install it, so puppet runs often cause issues such as
Error: /Stage[main]/Timezone/Exec[update_debconf area]: Could not evaluate: Could not find command 'debconf-get-selections'
Error: /Stage[main]/Timezone/Exec[update_debconf zone]: Could not evaluate: Could not find command 'debconf-get-selections'
When I attempt:
debconf { 'oracle-license-seen':
package => 'oracle-java8-installer',
item => 'shared/accepted-oracle-license-v1-1',
type => 'seen',
value => 'true',
}
I get:
Error: Parameter type failed on Debconf[oracle-license-seen]: Invalid value "seen".
Valid values are string, boolean, select, multiselect, note, text, password, title. (file: /vagrant/site/dk_oracle_java/manifests/install.pp, line: 40)
Expected this to work, as man pages show this is a valid type:
# Override default frontend to readline, but allow user to select.
debconf debconf/frontend select readline
debconf debconf/frontend seen false
puppet-lint forbids strings to be exactly a boolean value in resource definitions, so
debconf { 'dash/sh':
type => 'boolean',
value => 'true',
}
will cause a puppet-lint error, which in a restrictive environment may prevent the code from being checked into a production codebase. Using a verbatim boolean value does not work too, as your module expects a string. Currently we have to use the following (ugly) workaround:
debconf { 'dash/sh':
type => 'boolean',
value => 'true ', # space after "true" to work around puppet-lint warning
}
A possible workaround would be to add special handling for boolean values and require them to be provided as nativ puppet boolean values. Unfortunately I'm not a ruby coder, so I can't easily provide a pull request.
When I use debconf to preseed my mysql root password, this debconf is triggered on every puppet run:
Debug: Debconf: calling exists? for mysql-server/root_password
Debug: Debconf: caching data for mysql-server/root_password
Debug: Debconf: getting items for package mariadb-server-10.1
Debug: Executing: '/usr/bin/debconf-show mariadb-server-10.1'
Debug: Debconf: item mysql-server/root_password_again => (password omitted)
Debug: Debconf: item mysql-server/root_password => (password omitted)
Debug: Debconf: item mysql-server/password_mismatch =>
Debug: Debconf: item mysql-server/error_setting_password =>
Debug: Debconf: get mysql-server/root_password
Debug: Debconf: set mysql-server/root_password to secret
Debug: Debconf: updating mysql-server/root_password
Notice: /Stage[main]/Mysql::Package/Debconf[mysql-server/root_password]/value: value changed '(password omitted)' to 'secret'
Debug: /Stage[main]/Mysql::Package/Debconf[mysql-server/root_password]: The container Class[Mysql::Package] will propagate my refresh event
This is caused by the fact that the password is stored as "(password omitted)".
Maybe it is a better solution to check "password" types in the password database:
echo "get mysql-server/root_password" | debconf-communicate mariadb-server-10.1
0 secret
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Unknown resource type: 'debconf' at /etc/puppetlabs/puppet/modules/timezone/manifests/init.pp:84:7
maybe need to add [email protected]:smoeding/puppet-debconf.git as a dependency in the readme?
Hello,
I installed your module on puppet 8 in order to use it with the saz/timezone module.
I get this on a Debian 12 agent:
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Unknown resource type: 'debconf' (file: /etc/puppetlabs/code/environments/production/modules/timezone/manifests/init.pp, line: 75, column: 7) on node debian12tpl.my.com
Whereas on the server I get this:
root@puppet8:/# puppet resource debconf
Error: Could not run: To support listing resources of this type the 'debian' provider needs to implement an 'instances' class method returning the current set of resources. We recommend porting your module to the simpler Resource API instead: https://puppet.com/search/docs?keys=resource+api
Any idea on how to solve this issue?
Thanks, Stefano.
Using this type shows zombie processes during a Puppet run:
# ps axf
44433 ? Ssl 0:02 /opt/puppetlabs/puppet/bin/ruby /opt/puppetlabs/puppet/bin/puppet agent --no-dae
7264 ? Rl 0:08 \_ puppet agent: applying configuration
7418 ? Z 0:00 \_ [debconf-communi] <defunct>
7420 ? Z 0:00 \_ [debconf-communi] <defunct>
The zombie processes do disappear when the agent finishes its apply.
Hello, in the process of installing oracle java, I need to create something like this.
debconf { 'oracle-license-select':
package => 'oracle-java8-installer',
item => 'shared/accepted-oracle-license-v1-1',
type => 'select',
value => 'true',
}
debconf { 'oracle-license-seen':
package => 'oracle-java8-installer',
item => 'shared/accepted-oracle-license-v1-1',
type => 'seen',
value => 'true',
}
But when doing this, I get this error:
Error: Evaluation Error: Error while evaluating a Resource Statement, Cannot alias Debconf[oracle-license-seen] to ["shared/accepted-oracle-license-v1-1"] at (file: /vagrant/site/dk_oracle_java/manifests/install.pp, line: 40);
resource ["Debconf", "shared/accepted-oracle-license-v1-1"] already declared (file: /vagrant/site/dk_oracle_java/manifests/install.pp, line: 33) (file: /vagrant/site/dk_oracle_java/manifests/install.pp, line: 40, column: 3) on node test.box
It looks like the puppet code sets up a 1:1 relationship between name and type, but using debconf-set-selections
you can setup multiple types w/ value for the same name (1:many). In the command line, I can do this.
NAME=shared/accepted-oracle-license-v1-1
PACKAGE=oracle-java8-installer
VALUE=true
for TYPE in select seen; do
echo "${PACKAGE} ${NAME} ${TYPE} ${VALUE}" | debconf-set-selections
done
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.