Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
puppet-console
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Thomas Bellman
puppet-console
Commits
25cb32db
Commit
25cb32db
authored
Jul 8, 2019
by
Thomas Bellman
Committed by
Thomas Bellman
Jul 8, 2019
Browse files
Options
Downloads
Patches
Plain Diff
Add support for EL-6 in console::serial::login.
Signed-off-by:
Thomas Bellman
<
bellman@lysator.liu.se
>
parent
bee2f269
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
manifests/serial/login.pp
+95
-2
95 additions, 2 deletions
manifests/serial/login.pp
with
95 additions
and
2 deletions
manifests/serial/login.pp
+
95
−
2
View file @
25cb32db
...
...
@@ -13,8 +13,6 @@
*
-
rootlogin
To
'allow'
or
'forbid'
root
to
login
on
the
port
.
*
Default
is
to
make
no
changes
to
/
etc
/
securetty
.
*/
# FIXME: Currently only supports systemd
define
console::serial::login
(
$ensure
=
'enabled'
,
$speeds
=
[
115200
,
38400
,
9600
],
...
...
@@ -40,6 +38,14 @@ define console::serial::login(
}
}
/
^
upstart
::(
CentOS
|
Redhat
|
Scientific
)
-
6
(
\
.
|
$
)
/
:
{
console::serial::login::rhel_6
{
$name
:
ensure
=>
$ensure
,
speeds
=>
$speeds
,
termtype
=>
$termtype
;
}
}
default
:
{
fail
(
"Console::Serial::Login[
${title}
]: "
,
"Unsupported operating system/init system"
)
...
...
@@ -97,3 +103,90 @@ define console::serial::login::systemd(
;
}
}
# Internal helper definition
#
define
console::serial::login::rhel_6
(
$ensure
,
$speeds
,
$termtype
)
{
$svcname
=
"serial-
${name}
"
$xspeeds
=
inline_template
(
'<%= [@speeds].flatten.join(",") %>'
)
if
(
$ensure
==
'enabled'
)
{
include
console::serial::login::rhel_6::disable_auto_serial
$lines
=
[
'start on stopped rc RUNLEVEL=[2345]'
,
'stop on starting runlevel [016]'
,
'respawn'
,
"exec /sbin/agetty /dev/
${name}
${xspeeds}
${termtype}
"
,
]
file
{
"/etc/init/
${svcname}
.conf"
:
ensure
=>
file
,
owner
=>
'root'
,
group
=>
'root'
,
mode
=>
0444
,
content
=>
inline_template
(
'<%= @lines.join("\n") + "\n" -%>'
),
notify
=>
Exec
[
"console::serial::login::rhel_6::
${name}
"
];
}
exec
{
"console::serial::login::rhel_6::autoserial-stop::
${name}
"
:
command
=>
shellquote
(
'/sbin/initctl'
,
'stop'
,
'serial'
,
"DEV=
${name}
"
),
onlyif
=>
sprintf
(
'%s | /bin/grep -q "start/running"'
,
shellquote
(
'/sbin/initctl'
,
'status'
,
'serial'
,
"DEV=
${name}
"
)),
path
=>
'/sbin:/usr/sbin:/bin:/usr/bin'
,
before
=>
Class
[
'console::serial::login::rhel_6::disable_auto_serial'
];
"console::serial::login::rhel_6::
${name}
"
:
command
=>
shellquote
(
'/sbin/initctl'
,
'start'
,
$svcname
),
unless
=>
sprintf
(
'%s | /bin/grep -q "start/running"'
,
shellquote
(
'/sbin/initctl'
,
'status'
,
$svcname
)
),
path
=>
'/sbin:/usr/sbin:/bin:/usr/bin'
,
refreshonly
=>
true
;
}
}
elsif
(
$ensure
==
'disabled'
)
{
file
{
"/etc/init/
${svcname}
.conf"
:
ensure
=>
absent
,
require
=>
Exec
[
"console::serial::login::rhel_6::
${name}
"
];
}
exec
{
"console::serial::login::rhel_6::
${name}
"
:
command
=>
shellquote
(
'/sbin/initctl'
,
'stop'
,
$svcname
),
onlyif
=>
sprintf
(
'%s | /bin/grep -q "start/running"'
,
shellquote
(
'/sbin/initctl'
,
'status'
,
$svcname
)),
path
=>
'/sbin:/usr/sbin:/bin:/usr/bin'
;
}
}
}
# Internal helper class
# The default /etc/init/serial.conf upstart job runs an agetty process on the
# primary console, if it is a serial port. That clashes with an agetty job
# configured explicitly on that port. Disable this automatic running of
# agetty, to avoid this.
#
class
console::serial::login::rhel_6::disable_auto_serial
{
disable_file
{
'/etc/init/serial.conf'
:
renameto
=>
'%D/%F.DISABLED'
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment