コード例 #1
0
 def get_keychain_key(self):
     key_from_env = os.environ.get("CUMULUSCI_KEY")
     try:
         key_from_keyring = keyring.get_password("cumulusci",
                                                 "CUMULUSCI_KEY")
         has_functioning_keychain = True
     except Exception:
         key_from_keyring = None
         has_functioning_keychain = False
     # If no key in environment or file, generate one
     key = key_from_env or key_from_keyring
     if key is None:
         if has_functioning_keychain:
             key = random_alphanumeric_underscore(length=16)
         else:
             raise KeychainKeyNotFound(
                 "Unable to store CumulusCI encryption key. "
                 "You can configure it manually by setting the CUMULUSCI_KEY "
                 "environment variable to a random 16-character string.")
     if has_functioning_keychain and not key_from_keyring:
         keyring.set_password("cumulusci", "CUMULUSCI_KEY", key)
     return key
コード例 #2
0
 def get_keychain_key(self):
     key_from_env = os.environ.get("CUMULUSCI_KEY")
     try:
         key_from_keyring = keyring.get_password("cumulusci", "CUMULUSCI_KEY")
         has_functioning_keychain = True
     except Exception:
         key_from_keyring = None
         has_functioning_keychain = False
     # If no key in environment or file, generate one
     key = key_from_env or key_from_keyring
     if key is None:
         if has_functioning_keychain:
             key = random_alphanumeric_underscore(length=16)
         else:
             raise KeychainKeyNotFound(
                 "Unable to store CumulusCI encryption key. "
                 "You can configure it manually by setting the CUMULUSCI_KEY "
                 "environment variable to a random 16-character string."
             )
     if has_functioning_keychain and not key_from_keyring:
         keyring.set_password("cumulusci", "CUMULUSCI_KEY", key)
     return key
コード例 #3
0
 def _generate_id_and_secret(self):
     self.client_id = random_alphanumeric_underscore(self.client_id_length)
     self.client_secret = random_alphanumeric_underscore(
         self.client_secret_length)
コード例 #4
0
 def _generate_id_and_secret(self):
     self.client_id = random_alphanumeric_underscore(self.client_id_length)
     self.client_secret = random_alphanumeric_underscore(self.client_secret_length)