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

Added a new attribute with a policy queue to the script table

This commit is contained in:
Valery Sinelnikov 2022-04-15 11:41:40 +04:00 committed by Evgeny Sinelnikov
parent 326dc0600b
commit d6c438f277
4 changed files with 8 additions and 3 deletions

View File

@ -162,7 +162,7 @@ class gpt:
else:
gpt.__sid_gpt = self.sid
gpt.__policy_num = 0
self.policy_num = gpt.__policy_num
self.guid = self.path.rpartition('/')[2]
if 'default' == self.guid:
self.guid = 'Local Policy'
@ -233,7 +233,7 @@ class gpt:
logdata = dict({'pref': preference_path, 'sid': self.sid})
log('D28', logdata)
preference_objects = read_scripts(preference_path)
merge_scripts(self.storage, self.sid, preference_objects, self.name, gpt.__policy_num)
merge_scripts(self.storage, self.sid, preference_objects, self.name, str(self.policy_num).zfill(5))
except Exception as exc:
logdata = dict()
logdata['gpt'] = self.name
@ -264,7 +264,7 @@ class gpt:
logdata = dict({'pref': preference_path, 'sid': self.sid})
log('D29', logdata)
preference_objects = read_scripts(preference_path)
merge_scripts(self.storage, self.sid, preference_objects, self.name, gpt.__policy_num)
merge_scripts(self.storage, self.sid, preference_objects, self.name, str(self.policy_num).zfill(5))
except Exception as exc:
logdata = dict()
logdata['gpt'] = self.name

View File

@ -47,6 +47,7 @@ def read_scripts(scripts_file):
def merge_scripts(storage, sid, scripts_objects, policy_name, policy_num):
for script in scripts_objects:
script.policy_num = policy_num
storage.add_script(sid, script, policy_name)
@ -54,6 +55,7 @@ class script:
def __init__(self, action):
self.action = action
self.queue = str()
self.policy_num = str()
self.path = str()
self.arg = str()

View File

@ -183,6 +183,7 @@ class script_entry(object):
self.policy_name = policy_name
self.action = scrobj.action
self.queue = scrobj.queue
self.policy_num = scrobj.policy_num
self.path = scrobj.path
self.arg = scrobj.arg
@ -195,6 +196,7 @@ class script_entry(object):
fields['policy_name'] = self.policy_name
fields['action'] = self.action
fields['queue'] = self.queue
fields['policy_num'] = self.policy_num
fields['path'] = self.path
fields['arg'] = self.arg

View File

@ -151,6 +151,7 @@ class sqlite_registry(registry):
, Column('sid', String)
, Column('policy_name', String)
, Column('queue', String)
, Column('policy_num', String)
, Column('action', String)
, Column('path', String)
, Column('arg', String)