Beispiel #1
0
 def do_action_set(self, args):
     import re
     if not args.contents:
         return get_defaults(False, True, False) if args.is_global else get_defaults(True, True, False)
     kv_pairs = []
     for content in args.contents:
         m = re.match("^([^=]+?)([\+|\-]*=)([^=]*)$", content)
         if m:
             kv_pairs.append(m.groups())
         else:
             kv_pairs.append((content, '', ''))
     for kv_pair in kv_pairs:
         assert kv_pair[0] and kv_pair[1] in ["=", "+=", "-="] and kv_pair[2], \
             f"must specify a key=value pair ({kv_pair[0]}, {kv_pair[2]})"
         update_default(kv_pair[0], kv_pair[2], is_global=args.is_global)
Beispiel #2
0
 def do_action_unset(self, args):
     for kv_pair in args.contents:
         update_default(kv_pair[0], kv_pair[2], is_global=args.is_global, to_delete=True)
Beispiel #3
0
 def do_action_select(self, args):
     update_default('cluster-alias', args.cluster_alias,
                    is_global=args.is_global)