uci: Initial version.

This commit is contained in:
Timo Makinen 2013-11-26 23:40:41 +02:00
parent 9ba1c7abf8
commit 76ddba55d8

44
uci/manifests/init.pp Normal file
View file

@ -0,0 +1,44 @@
# Helper class for UCI commit
#
class uci {
if $::operatingsystem != "OpenWRT" {
fail("uci not supported on ${::operatingsystem}")
}
exec { "uci commit":
user => "root",
path => "/bin:/usr/bin:/sbin:/usr/sbin",
refreshonly => true,
}
}
# Set value using UCI
#
# === Parameters
#
# $name:
# UCI key to set
# $value:
# Value for given key
#
# === Sample usage
#
# uci::set { "uhttpd.main.listen_http":
# value => "8080",
# }
#
define uci::set($value) {
include uci
exec { "uci set ${name}=${value}":
user => "root",
path => "/bin:/usr/bin:/sbin:/usr/sbin",
unless => "uci get ${name} | egrep '^${value}\$'",
notify => Exec["uci commit"],
}
}