Skip to content
Snippets Groups Projects
Commit 92ef9f35 authored by Thomas Bellman's avatar Thomas Bellman Committed by Thomas Bellman
Browse files

Add config class for console::serial defs/classes.


We here add a parameter class 'console::serial::config', so users can
set defaults for the console::serial::login definition, and future
console::serial::* classes and definitions.

Signed-off-by: default avatarThomas Bellman <bellman@lysator.liu.se>
parent e96619ce
No related branches found
No related tags found
No related merge requests found
# Copyright © 2021 Thomas Bellman, Linköping, Sweden
# Licensed under the GNU LGPL v3+; see the README file for more information.
/*
* Configuration and default parameter values for console::serial::*
* classes and definitions.
*/
class console::serial::config(
# Options to pass to the (a)getty process when logins on a port
# are enabled. The default is to follow what the operating
# system on the node normally does.
#
$getty_options = undef,
# Speed or speeds (in bits/second) getty should use
#
$speeds = [ 115200, 38400, 9600 ],
# Default terminal type connected to ports
#
$termtype = 'vt100',
)
{
# Empty class
}
......@@ -7,20 +7,23 @@
*
* Parameters:
* - name Name of serial port device (without /dev/ prefix).
* - getty_options Options to pass to the getty process.
* The defaults depend on the operating system.
* - ensure One of 'enabled' (the default) or 'disabled'.
* - speeds (List of) speeds in bits/second.
* - termtype Default terminal type connected to the port.
* - rootlogin To 'allow' or 'forbid' root to login on the port.
* Default is to make no changes to /etc/securetty.
*
* In addition, the following parameters also exist, and get their
* default values from console::serial::config. See that class for
* the meaning and default values of those parameters.
* - getty_options
* - speeds
* - termtype
*/
define console::serial::login(
$ensure = 'enabled',
$getty_options=undef,
$speeds=[115200,38400,9600],
$termtype='vt100',
$rootlogin = undef,
$getty_options = undef, # Default from console::serial::config
$speeds = undef, # Default from console::serial::config
$termtype = undef, # Default from console::serial::config
)
{
case $ensure {
......@@ -31,15 +34,30 @@ define console::serial::login(
}
}
# Get defaults from console::serial::config.
include console::serial::config
$x_getty_options = $getty_options ? {
undef => $console::serial::config::getty_options,
default => $getty_options
}
$x_speeds = $speeds ? {
undef => $console::serial::config::speeds,
default => $speeds
}
$x_termtype = $termtype ? {
undef => $console::serial::config::termtype,
default => $termtype
}
case "${::initsystem}::${::operatingsystem}-${::operatingsystemrelease}"
{
/systemd::.*/: {
console::serial::login::systemd {
$name:
ensure => $ensure,
getty_options => $getty_options,
speeds => $speeds,
termtype => $termtype;
getty_options => $x_getty_options,
speeds => $x_speeds,
termtype => $x_termtype;
}
}
......@@ -47,9 +65,9 @@ define console::serial::login(
console::serial::login::rhel_6 {
$name:
ensure => $ensure,
getty_options => $getty_options,
speeds => $speeds,
termtype => $termtype;
getty_options => $x_getty_options,
speeds => $x_speeds,
termtype => $x_termtype;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment