Commit 187f09be authored by Kaarle Ritvanen's avatar Kaarle Ritvanen

exit with 0 if policy already enabled/disabled

parent 20407dfd
Policy file handling for Alpine Wall
Copyright (C) 2012-2014 Kaarle Ritvanen
Copyright (C) 2012-2016 Kaarle Ritvanen
See LICENSE file for license details
......@@ -14,6 +14,7 @@ local contains = util.contains
local keys = util.keys
local listpairs = util.listpairs
local map =
local printmsg = util.printmsg
local json = require('cjson')
......@@ -85,14 +86,14 @@ end
function Policy:enable()
if self.enabled then raise('Policy already enabled: ' end
assert(, self.confdir..'/'..self.fname, true))
if self.enabled then printmsg('Policy already enabled: '
else assert(, self.confdir..'/'..self.fname, true)) end
function Policy:disable()
if not self.enabled then raise('Policy already disabled: ' end
if self.enabled then assert(os.remove(self.confdir..'/'..self.fname))
else printmsg('Policy already disabled: ' end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment