Skip to content

Commit

Permalink
doc update
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshua Hoblitt committed Aug 30, 2013
1 parent da6d309 commit 19574a6
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 18 deletions.
36 changes: 35 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,49 @@ Manages the policykit package
Description
-----------

Ensures that the PolicyKit or
[`polkit`](http://www.freedesktop.org/wiki/Software/polkit/) is installed and
provides a mechanism for managing localauthority configuration files.


Usage
-----

To only ensure that the policykit software package is installed. Note that
this isn't nessicary when used the `policykit::localauthority` defined type as
including the `policykit` class is implied.

include policykit

Create a new authority file.

policykit::localauthority { 'Disable suspend':
identity => 'unix-user:*',
action => 'org.freedesktop.upower.suspend',
result_active => 'no',
result_any => 'no',
result_inactive => 'no',
}

To remove an existing authority configuration. Note that all of the params are
still required. This is arguably a bug.

policykit::localauthority { 'Disable suspend':
ensure => absent,
identity => 'unix-user:*',
action => 'org.freedesktop.upower.suspend',
result_active => 'no',
result_any => 'no',
result_inactive => 'no',
}


Limitations
-----------

At present, only support for `$::osfamily == 'RedHat'` has been implimented.
Adding other Linux distrubtions should be trivial.
Adding other Linux distrubtions should be trivial. Policykit is not present in
releases prior to el6.x.

### Tested on

Expand Down
12 changes: 7 additions & 5 deletions manifests/init.pp
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# == Class: policykit
#
# D-INFK SANS
# ===========
# === Examples
#
# Copyright: Steven Armstrong, Nico Schottelius
# include policykit
#
# License: GPLv3
# === Copyright
#
# Copyright: Steven Armstrong, Nico Schottelius
# Copyright (C) 2013 Joshua Hoblitt
#

class policykit inherits policykit::params {

package { $policykit::params::policykit_package:
Expand Down
24 changes: 12 additions & 12 deletions manifests/localauthority.pp
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# == Define: policykit::localauthority
#
# D-INFK SANS
# ===========
#
# Copyright: Steven Armstrong, Nico Schottelius
#
# License: GPLv3
#

# === Examples
#
# policykit::localauthority { 'Disable suspend':
# identity => 'unix-user:*',
# action => 'org.freedesktop.upower.suspend',
# result_active => 'no',
# result_any => 'no',
# identity => 'unix-user:*',
# action => 'org.freedesktop.upower.suspend',
# result_active => 'no',
# result_any => 'no',
# result_inactive => 'no',
# }
#
# === Copyright
#
# Copyright: Steven Armstrong, Nico Schottelius
# Copyright (C) 2013 Joshua Hoblitt
#
define policykit::localauthority(
$identity,
$action,
Expand Down
22 changes: 22 additions & 0 deletions spec/defines/localauthority_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,28 @@
end
end

describe 'example from docs' do
# example from https://wiki.archlinux.org/index.php/PolicyKit
let(:title) { 'Disable suspend' }
let :params do
{
:identity => 'unix-user:*',
:action => 'org.freedesktop.upower.suspend',
:result_active => 'no',
:result_any => 'no',
:result_inactive => 'no',
}
end

it do
should contain_file('/etc/polkit-1/localauthority/50-local.d/Disable_suspend.pkla').
with({
:ensure => 'present',
:mode => '0644',
})
end
end

describe 'ensure => absent' do
let(:title) { 'foo' }
let :params do
Expand Down

0 comments on commit 19574a6

Please sign in to comment.