Skip to content

Commit 037e88f

Browse files
authored
Merge pull request #1929 from lsst-it/IT-6510/ccs-vw-sessions
(profile::ccs::autologin) misc improvements
2 parents 2753896 + 2059c2c commit 037e88f

File tree

3 files changed

+36
-7
lines changed

3 files changed

+36
-7
lines changed

hieradata/role/ccs-viswork.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
classes:
33
- "profile::ccs::autologin"
4+
- "profile::ccs::autologout"
45
- "profile::ccs::common"
56
- "profile::ccs::graphical"
67
- "profile::core::common"

site/profile/manifests/ccs/autologin.pp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,23 @@
88
if $enable {
99
ensure_packages(['gdm'])
1010

11-
exec { 'Enable autologin for graphical ccs user':
11+
exec { 'Enable timedlogin for graphical ccs user':
1212
path => ['/usr/bin'],
13-
unless => 'grep -q ^AutomaticLogin /etc/gdm/custom.conf',
13+
unless => 'grep -q ^TimedLogin /etc/gdm/custom.conf',
1414
# lint:ignore:strict_indent
1515
command => @("CMD"/L),
1616
sed -i '/^\[daemon.*/a\\
17-
AutomaticLogin=ccs\n\
18-
AutomaticLoginEnable=true' /etc/gdm/custom.conf
17+
TimedLogin=ccs\n\
18+
TimedLoginDelay=60\n\
19+
TimedLoginEnable=true' /etc/gdm/custom.conf
1920
| CMD
2021
# lint:endignore
2122
}
2223
} else {
23-
exec { 'Disable autologin for graphical ccs user':
24+
exec { 'Disable timedlogin for graphical ccs user':
2425
path => ['/usr/bin'],
25-
onlyif => 'grep -q ^AutomaticLogin=ccs /etc/gdm/custom.conf',
26-
command => 'sed -i "/^AutomaticLogin/d" /etc/gdm/custom.conf',
26+
onlyif => 'grep -q ^TimedLogin=ccs /etc/gdm/custom.conf',
27+
command => 'sed -i "/^TimedLogin/d" /etc/gdm/custom.conf',
2728
}
2829
}
2930
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# @summary
2+
# Enable automatic logout for gnome sessions.
3+
#
4+
class profile::ccs::autologout {
5+
$dconf_power = 'org/gnome/settings-daemon/plugins/power'
6+
$dconf_sleep = 'sleep-inactive-ac'
7+
8+
## Cannot lock -type, since need to change it for the ccs user.
9+
dconf::settings { 'gnome power inactive-ac':
10+
settings_hash => {
11+
$dconf_power => {
12+
"${dconf_sleep}-timeout" => { 'value' => 900, 'lock' => true },
13+
"${dconf_sleep}-type" => { 'value' => "'logout'", 'lock' => false },
14+
},
15+
},
16+
}
17+
18+
## Set sleep-inactive-ac-type='nothing' for the CCS user.
19+
$ccs_user = 'ccs'
20+
21+
exec { 'ccs dconf disable autologout':
22+
path => ['/usr/bin/'],
23+
command => "dbus-launch dconf write /${dconf_sleep}-type \"'nothing'\"",
24+
user => $ccs_user,
25+
unless => "dconf read /${dconf_sleep}-type | grep -q nothing",
26+
}
27+
}

0 commit comments

Comments
 (0)