You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/08/31 08:19:56 UTC

[GitHub] [airflow] uranusjr commented on a change in pull request #17448: Aws secrets manager backend

uranusjr commented on a change in pull request #17448:
URL: https://github.com/apache/airflow/pull/17448#discussion_r699094690



##########
File path: airflow/providers/amazon/aws/secrets/secrets_manager.py
##########
@@ -75,49 +80,100 @@ def __init__(
         config_prefix: str = 'airflow/config',
         profile_name: Optional[str] = None,
         sep: str = "/",
+        full_url_mode: bool = True,
         **kwargs,
     ):
         super().__init__()
         if connections_prefix is not None:
-            self.connections_prefix = connections_prefix.rstrip("/")
+            self.connections_prefix = connections_prefix.rstrip(sep)
         else:
             self.connections_prefix = connections_prefix
         if variables_prefix is not None:
-            self.variables_prefix = variables_prefix.rstrip('/')
+            self.variables_prefix = variables_prefix.rstrip(sep)
         else:
             self.variables_prefix = variables_prefix
         if config_prefix is not None:
-            self.config_prefix = config_prefix.rstrip('/')
+            self.config_prefix = config_prefix.rstrip(sep)
         else:
             self.config_prefix = config_prefix
         self.profile_name = profile_name
         self.sep = sep
+        self.full_url_mode = full_url_mode
         self.kwargs = kwargs
 
     @cached_property
     def client(self):
         """Create a Secrets Manager client"""
-        session = boto3.session.Session(
-            profile_name=self.profile_name,
-        )
+        session = boto3.session.Session(profile_name=self.profile_name)
+
         return session.client(service_name="secretsmanager", **self.kwargs)
 
-    def get_conn_uri(self, conn_id: str) -> Optional[str]:
+    def _get_extra(self, secret, conn_string):
+        if 'extra' in secret:
+            extra_dict = secret['extra']
+            conn_string = f"{conn_string}?{urlencode(extra_dict)}"
+            return conn_string
+
+        return conn_string

Review comment:
       ```suggestion
       def _get_extra(self, secret, conn_string):
           try:
               extra_dict = secret['extra']
           except KeyError:
               return conn_string
           conn_string = f"{conn_string}?{urlencode(extra_dict)}"
           return conn_string
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org