mirror of
https://github.com/altlinux/gpupdate.git
synced 2025-03-21 10:50:35 +03:00
Catch exception on PolicyKit generation errors
This commit is contained in:
parent
f5d2c6c3bc
commit
bdf96d8cac
@ -34,9 +34,14 @@ class polkit:
|
||||
self.outfile = os.path.join(self.__policy_dir, '{}.rules'.format(self.template_name))
|
||||
|
||||
def generate(self):
|
||||
template = self.__template_environment.get_template(self.infilename)
|
||||
text = template.render(**self.args)
|
||||
with open(self.outfile, 'w') as f:
|
||||
f.write(text)
|
||||
logging.debug(slogm('Generated file {} with arguments {}'.format(self.outfile, self.args)))
|
||||
try:
|
||||
template = self.__template_environment.get_template(self.infilename)
|
||||
text = template.render(**self.args)
|
||||
|
||||
with open(self.outfile, 'w') as f:
|
||||
f.write(text)
|
||||
|
||||
logging.debug(slogm('Generated file {} with arguments {}'.format(self.outfile, self.args)))
|
||||
except Exception as exc:
|
||||
logging.error(slogm('Unable to generate file {} from {}'.format(self.outfile, self.infilename)))
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user