Bugzilla – Attachment 868 Details for
Bug 6122
tl-config can't delete any configuration
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch that adds a delete parameter option to hivetool
b6122.patch (text/plain), 2.99 KB, created by
Samuel Mannehed
on 2018-05-31 09:17:26 CEST
(
hide
)
Description:
Patch that adds a delete parameter option to hivetool
Filename:
MIME Type:
Creator:
Samuel Mannehed
Created:
2018-05-31 09:17:26 CEST
Size:
2.99 KB
patch
obsolete
>diff --git a/tlmisc/hiveconf/hivetool b/tlmisc/hiveconf/hivetool >index f524ef724..282717131 100755 >--- a/tlmisc/hiveconf/hivetool >+++ b/tlmisc/hiveconf/hivetool >@@ -35,11 +35,16 @@ def get_value(s): > return tuple(words) > > >-def handle_param(hive, param): >- """Print parameter. Returns zero on success""" >+def handle_param(hive, param, delete=False): >+ """ Get / Set or Delete parameter. Returns zero on success""" > (paramtype, param) = get_type(param) > (parampath, value) = get_value(param) > >+ if delete: >+ # Delete parameter >+ hive.delete(parampath) >+ return 0 >+ > if not value: > # Display value > method = getattr(hive, "get_%s" % paramtype) >@@ -48,7 +53,7 @@ def handle_param(hive, param): > except hiveconf.NotAParameterError: > print >>sys.stderr, "%s: Not a parameter" % parampath > return 1 >- >+ > if value == None: > print >>sys.stderr, "%s: No such parameter" % parampath > return 1 >@@ -81,7 +86,6 @@ def eval_print(hive, varname, param, export): > else: > return 0 > >- > def imp_walk(hive, ih, folderpath): > # Handle parameters and values > for paramname in ih.get_parameters(folderpath): >@@ -126,6 +130,7 @@ hivetool [options] [type:]parameter[=value] ... > > -a,--all-entries Print all parameters and values in a folder > -i,--import <file> Import all parameters in specified file >+ -d,--delete Delete all specified parameters > -p,--purge <file> Remove parameters in specified file which exists elsewhere > -R,--recursive When using -a, ascend folders recursively > -r,--root <file> Specify root hive file. Default is /etc/root.hconf >@@ -152,7 +157,7 @@ hivetool [options] [type:]parameter[=value] ... > > def main(): > try: >- opts, args = getopt.getopt(sys.argv[1:], "a:i:p:Rr:ve:E:x?", >+ opts, args = getopt.getopt(sys.argv[1:], "a:i:dp:Rr:ve:E:x?", > ["all-entries=", "import=", "purge=", "recursive", "root=", "version", "help", > "eval=", "export"]) > except getopt.GetoptError: >@@ -164,6 +169,7 @@ def main(): > imp_files = [] > purge_files = [] > recursive = 0 >+ delete_params = False > e_params =[] > E_params = [] > eval_export = 0 >@@ -172,6 +178,8 @@ def main(): > walk_folders.append(a) > if o in ("-i", "--import"): > imp_files.append(a) >+ if o in ("-d", "--delete"): >+ delete_params = True > if o in ("-p", "--purge"): > purge_files.append(a) > if o in ("-R", "--recursive"): >@@ -230,9 +238,9 @@ def main(): > for param in params: > errors += eval_print(folder, param, param, eval_export) > >- # Get/set listed parameters >+ # Get/set/delete listed parameters > for param in args: >- errors += handle_param(hive, param) >+ errors += handle_param(hive, param, delete_params) > > # Walk > for foldername in walk_folders:
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 6122
: 868