コード例 #1
0
def main():
    """edit password in passwords.yml file

    sys.argv:
    -p path  # path to passwords.yaml
    -k key   # key of password
    -v value # value of password
    -c       # flag to clear the password
    -l       # print to stdout a csv string of the existing keys
    """
    opts, _ = getopt.getopt(sys.argv[1:], 'p:k:v:cl')
    path = ''
    pwd_key = ''
    pwd_value = ''
    clear_flag = False
    list_flag = False
    for opt, arg in opts:
        if opt == '-p':
            path = arg
        elif opt == '-k':
            pwd_key = arg
        elif opt == '-v':
            pwd_value = arg
        elif opt == '-c':
            clear_flag = True
        elif opt == '-l':
            list_flag = True

    if list_flag:
        # print the password keys
        _print_pwd_keys(path)
    else:
        # edit a password
        utils.change_property(path, pwd_key, pwd_value, clear_flag)
コード例 #2
0
ファイル: properties.py プロジェクト: meganeshkadam/kolla-cli
 def clear_property(self, property_key):
     # We only manipulate values in the globals.yml file so if the variable
     # does not exist we will do nothing.  if it does exist we need to find
     # the line and nuke it.
     try:
         change_property(self.globals_path, property_key, None, clear=True)
     except Exception as e:
         raise e
コード例 #3
0
 def clear_property(self, property_key):
     # We only manipulate values in the globals.yml file so if the variable
     # does not exist we will do nothing.  if it does exist we need to find
     # the line and nuke it.
     try:
         change_property(self.globals_path, property_key,
                         None, clear=True)
     except Exception as e:
         raise e
コード例 #4
0
 def set_property(self, property_key, property_value):
     # We only manipulate values in the globals.yml file so look up the key
     # and if it is there, we will parse through the file to replace that
     # line.  if the key doesn't exist we append to the end of the file
     try:
         change_property(self.globals_path, property_key,
                         property_value, clear=False)
     except Exception as e:
         raise e
コード例 #5
0
ファイル: properties.py プロジェクト: meganeshkadam/kolla-cli
 def set_property(self, property_key, property_value):
     # We only manipulate values in the globals.yml file so look up the key
     # and if it is there, we will parse through the file to replace that
     # line.  if the key doesn't exist we append to the end of the file
     try:
         change_property(self.globals_path,
                         property_key,
                         property_value,
                         clear=False)
     except Exception as e:
         raise e