1
0
mirror of https://github.com/altlinux/gpupdate.git synced 2025-03-21 18:50:38 +03:00

cups_applier: Run only if it is enabled

This commit is contained in:
Игорь Чудов 2020-06-26 20:18:23 +04:00
parent 41f49e5bab
commit f680a3025e
Signed by untrusted user: nir
GPG Key ID: 0F3883600CAE7AAC

View File

@ -73,10 +73,7 @@ class cups_applier(applier_frontend):
self.storage = storage
self.__module_enabled = check_module_enabled(self.storage, self.__module_name, self.__module_enabled)
def apply(self):
'''
Perform configuration of printer which is assigned to computer.
'''
def run(self):
if not is_rpm_installed('cups'):
logging.warning(slogm('CUPS is not installed: no printer settings will be deployed'))
return
@ -88,6 +85,13 @@ class cups_applier(applier_frontend):
for prn in self.printers:
connect_printer(self.cups_connection, prn)
def apply(self):
'''
Perform configuration of printer which is assigned to computer.
'''
if self.__module_enabled:
self.run()
class cups_applier_user(applier_frontend):
__module_name = 'cups_applier_user'
__module_experimental = True
@ -106,10 +110,7 @@ class cups_applier_user(applier_frontend):
'''
pass
def admin_context_apply(self):
'''
Perform printer configuration assigned for user.
'''
def run(self):
if not is_rpm_installed('cups'):
logging.warning(slogm('CUPS is not installed: no printer settings will be deployed'))
return
@ -121,3 +122,10 @@ class cups_applier_user(applier_frontend):
for prn in self.printers:
connect_printer(self.cups_connection, prn)
def admin_context_apply(self):
'''
Perform printer configuration assigned for user.
'''
if self.__module_enabled:
self.run()