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

Added logs for generating directories with scripts

This commit is contained in:
Valery Sinelnikov 2022-04-18 19:34:02 +04:00 committed by Evgeny Sinelnikov
parent 1e8a6c61c6
commit 474378d17d
3 changed files with 28 additions and 14 deletions

View File

@ -16,7 +16,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import subprocess
import os
import shutil
from pathlib import Path
@ -50,8 +49,12 @@ class scripts_applier(applier_frontend):
if sid in check_sid[machine_name]['sid']:
try:
remove_dir_tree(self.folder_path, True, True, True,)
except FileNotFoundError as exc:
log('D154')
except Exception as exc:
print('FAILED {}'.format(exc))
logdata = dict()
logdata['exc'] = exc
log('E64', logdata)
self.folder_path.mkdir(parents=True, exist_ok=True)
if self.__module_enabled:
for ts in self.scripts:
@ -64,12 +67,7 @@ class scripts_applier(applier_frontend):
def run(self):
pass
def apply(self):
self.run()
#if self.__module_enabled:
#log('D??')
#self.run()
#else:
#log('D??')
pass
class scripts_applier_user(applier_frontend):
__module_name = 'ScriptsApplierUser'
@ -90,8 +88,12 @@ class scripts_applier_user(applier_frontend):
if self.username[:-1] != os.uname()[1].upper():
try:
remove_dir_tree(self.folder_path, True, True, True,)
except FileNotFoundError as exc:
log('D155')
except Exception as exc:
print('FAILED {}'.format(exc))
logdata = dict()
logdata['exc'] = exc
log('E65', logdata)
self.folder_path.mkdir(parents=True, exist_ok=True)
if self.__module_enabled:
for ts in self.scripts:
@ -113,11 +115,6 @@ class scripts_applier_user(applier_frontend):
Install software assigned to specified username regardless
which computer he uses to log into system.
'''
#if self.__module_enabled:
#log('D??')
#self.run()
#else:
#log('D??')
pass
def install_script(storage_script_entry, script_path, access_permissions):

View File

@ -225,6 +225,12 @@ msgstr "Ошибка при запуске pkcon_runner асинхронно д
msgid "Error merging user GPT (from machine GPO)"
msgstr "Ошибка слияния пользовательской групповой политики (машинная часть)"
msgid "Error cleaning directory for machine"
msgstr "Ошибка очистки каталога для машины"
msgid "Error cleaning directory for user"
msgstr "Ошибка очистки каталога для пользователя"
# Error_end
# Debug
@ -663,6 +669,13 @@ msgstr "Настройка режима обработки замыкания п
msgid "Saving information about script"
msgstr "Сохранение информации о скрипте"
msgid "No machine scripts directory to clean up"
msgstr "Нет каталога машинных скриптов для очистки"
msgid "No user scripts directory to clean up"
msgstr "Нет каталога пользовательских скриптов для очистки"
# Debug_end
# Warning

View File

@ -98,6 +98,8 @@ def error_code(code):
error_ids[61] = 'Error running pkcon_runner async for machine'
error_ids[62] = 'Error running pkcon_runner async for user'
error_ids[63] = 'Error merging user GPT (from machine GPO)'
error_ids[64] = 'Error to cleanup directory for machine'
error_ids[65] = 'Error to cleanup directory for user'
return error_ids.get(code, 'Unknown error code')
@ -257,6 +259,8 @@ def debug_code(code):
debug_ids[151] = 'Failed to found user gsettings'
debug_ids[152] = 'Configure user Group Policy loopback processing mode'
debug_ids[153] = 'Saving information about script'
debug_ids[154] = 'No machine scripts directory to clean up'
debug_ids[155] = 'No user scripts directory to clean up'
return debug_ids.get(code, 'Unknown debug code')