Merge pull request #1 in KSC/webapp-tools from remove_option_to_webapp_settings to master
* commit '308910a75f975db164615a42c2314e5f6b2a20d8': Add option to remove webapp settings
This commit is contained in:
commit
c40f84d55d
@ -18,6 +18,7 @@ def opt_args():
|
|||||||
parser.add_option("--user", dest="user", action="store", help="Run script for user")
|
parser.add_option("--user", dest="user", action="store", help="Run script for user")
|
||||||
parser.add_option("--backup", dest="backup", action="store_true", help="Backup webapp setting ")
|
parser.add_option("--backup", dest="backup", action="store_true", help="Backup webapp setting ")
|
||||||
parser.add_option("--restore", dest="restore", action="store_true", help="Restore webapp settings")
|
parser.add_option("--restore", dest="restore", action="store_true", help="Restore webapp settings")
|
||||||
|
parser.add_option("--remove", dest="remove", action="store_true", help="Remove webapp settings")
|
||||||
|
|
||||||
return parser.parse_args()
|
return parser.parse_args()
|
||||||
|
|
||||||
@ -25,7 +26,7 @@ def opt_args():
|
|||||||
def main():
|
def main():
|
||||||
options, args = opt_args()
|
options, args = opt_args()
|
||||||
|
|
||||||
if not options.user or (not options.backup and not options.restore):
|
if not options.user or (not options.backup and not options.restore and not options.remove):
|
||||||
print 'Please use:\n %s --user <username> (--backup or --restore) ' % (sys.argv[0])
|
print 'Please use:\n %s --user <username> (--backup or --restore) ' % (sys.argv[0])
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
@ -43,7 +44,9 @@ def main():
|
|||||||
|
|
||||||
print data
|
print data
|
||||||
user.store.prop(PR_EC_WEBACCESS_SETTINGS_JSON).set_value(json.dumps(data))
|
user.store.prop(PR_EC_WEBACCESS_SETTINGS_JSON).set_value(json.dumps(data))
|
||||||
|
|
||||||
|
if options.remove:
|
||||||
|
user.store.delete(user.store.prop('PR_EC_WEBACCESS_SETTINGS_JSON'))
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
Loading…
Reference in New Issue
Block a user