Exemplo n.º 1
0
 def write_secret(
     self,
     action: str,
     secret_name: str,
     plaintext: bytes,
 ) -> None:
     with TempGpgKeyring(overwrite=True):
         ecosystems = self.get_vault_ecosystems_for_clusters()
         if 'VAULT_TOKEN_OVERRIDE' not in os.environ:
             username = getpass.getuser()
             password = getpass.getpass("Please enter your LDAP password to auth with Vault\n")
         else:
             username = None
             password = None
         for ecosystem in ecosystems:
             client = get_vault_client(
                 ecosystem=ecosystem,
                 username=username,
                 password=password,
             )
             encrypt_secret(
                 client=client,
                 action=action,
                 ecosystem=ecosystem,
                 secret_name=secret_name,
                 soa_dir=self.soa_dir,
                 plaintext=plaintext,
                 service_name=self.service_name,
                 transit_key=self.encryption_key,
             )
Exemplo n.º 2
0
 def write_secret(self, action: str, secret_name: str,
                  plaintext: bytes) -> None:
     with TempGpgKeyring(overwrite=True):
         for ecosystem in self.ecosystems:
             client = self.clients[ecosystem]
             encrypt_secret(
                 client=client,
                 action=action,
                 ecosystem=ecosystem,
                 secret_name=secret_name,
                 soa_dir=self.soa_dir,
                 plaintext=plaintext,
                 service_name=self.service_name,
                 transit_key=self.encryption_key,
             )