[GitHub] [airflow] subkanthi commented on a change in pull request #21222: Helm: Fix elasticsearch URL in secret when username/password fields are empty,
subkanthi commented on a change in pull request #21222: URL: https://github.com/apache/airflow/pull/21222#discussion_r803975711 ## File path: chart/templates/secrets/elasticsearch-secret.yaml ## @@ -33,6 +33,14 @@ metadata: type: Opaque data: {{- with .Values.elasticsearch.connection }} - connection: {{ urlJoin (dict "scheme" (default "http" .scheme) "userinfo" (printf "%s:%s" (.user | urlquery) (.pass | urlquery)) "host" (printf "%s:%s" .host ((default 9200 .port) | toString) ) ) | b64enc | quote }} - {{- end }} +{{- if .user }} + {{- if .pass }} + connection: {{ urlJoin (dict "scheme" (default "http" .scheme) "userinfo" (printf "%s:%s" (.user | urlquery) (.pass | urlquery)) "host" (printf "%s:%s" .host ((default 9200 .port) | toString) ) ) | b64enc | quote }} + {{- else}} + connection: {{ urlJoin (dict "scheme" (default "http" .scheme) "host" (printf "%s:%s" .host ((default 9200 .port) | toString))) | b64enc | quote }} + {{- end }} Review comment: Updated, thanks -- 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-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [airflow] subkanthi commented on a change in pull request #21222: Helm: Fix elasticsearch URL in secret when username/password fields are empty,
subkanthi commented on a change in pull request #21222: URL: https://github.com/apache/airflow/pull/21222#discussion_r803873125 ## File path: chart/tests/test_elasticsearch_secret.py ## @@ -132,3 +132,39 @@ def test_should_generate_secret_with_specified_schemes(self, scheme): ) assert f"{scheme}://username:password@elastichostname:9200" == connection + +def test_url_generated_when_user_is_empty(self): +connection = self._get_connection( +{ +"elasticsearch": { +"enabled": True, +"connection": {"pass": "password", "host": "elastichostname", "port": 8080}, +} +} +) + +assert "http://elastichostname:8080"; == connection + +def test_url_generated_when_password_is_empty(self): +connection = self._get_connection( +{ +"elasticsearch": { +"enabled": True, +"connection": {"user": "admin", "host": "elastichostname", "port": 8080}, +} +} +) + +assert "http://elastichostname:8080"; == connection + +def test_url_generated_with_valid_user_password(self): +connection = self._get_connection( +{ +"elasticsearch": { +"enabled": True, +"connection": {"user": "admin", "pass": "pass", "host": "elastichostname", "port": 8080}, +} +} +) + +assert "http://admin:pass@elastichostname:8080"; == connection Review comment: Thanks , tuple definitely made the difference. -- 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-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [airflow] subkanthi commented on a change in pull request #21222: Helm: Fix elasticsearch URL in secret when username/password fields are empty,
subkanthi commented on a change in pull request #21222: URL: https://github.com/apache/airflow/pull/21222#discussion_r801109387 ## File path: chart/tests/test_elasticsearch_secret.py ## @@ -132,3 +132,39 @@ def test_should_generate_secret_with_specified_schemes(self, scheme): ) assert f"{scheme}://username:password@elastichostname:9200" == connection + +def test_url_generated_when_user_is_empty(self): +connection = self._get_connection( +{ +"elasticsearch": { +"enabled": True, +"connection": {"pass": "password", "host": "elastichostname", "port": 8080}, +} +} +) + +assert "http://elastichostname:8080"; == connection + +def test_url_generated_when_password_is_empty(self): +connection = self._get_connection( +{ +"elasticsearch": { +"enabled": True, +"connection": {"user": "admin", "host": "elastichostname", "port": 8080}, +} +} +) + +assert "http://elastichostname:8080"; == connection + +def test_url_generated_with_valid_user_password(self): +connection = self._get_connection( +{ +"elasticsearch": { +"enabled": True, +"connection": {"user": "admin", "pass": "pass", "host": "elastichostname", "port": 8080}, +} +} +) + +assert "http://admin:pass@elastichostname:8080"; == connection Review comment: Thanks, Im actually having problems passing JSON in parametrized.expand, trying to figure out, for some reason the parameter only has the first key. ``` @parameterized.expand( [ # When user is empty ({"enabled": True, "connection" : {"pass": "password", "host": "elastichostname", "port": 8080}}), # When pass is empty # ({"connection": {"user": "admin", "host": "elastichostname", "port": 8080}}), # # When user and pass are empty # ({"connection": {"host": "elastichostname", "port": 8080}}), ], )``` -- 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-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [airflow] subkanthi commented on a change in pull request #21222: Helm: Fix elasticsearch URL in secret when username/password fields are empty,
subkanthi commented on a change in pull request #21222: URL: https://github.com/apache/airflow/pull/21222#discussion_r801109387 ## File path: chart/tests/test_elasticsearch_secret.py ## @@ -132,3 +132,39 @@ def test_should_generate_secret_with_specified_schemes(self, scheme): ) assert f"{scheme}://username:password@elastichostname:9200" == connection + +def test_url_generated_when_user_is_empty(self): +connection = self._get_connection( +{ +"elasticsearch": { +"enabled": True, +"connection": {"pass": "password", "host": "elastichostname", "port": 8080}, +} +} +) + +assert "http://elastichostname:8080"; == connection + +def test_url_generated_when_password_is_empty(self): +connection = self._get_connection( +{ +"elasticsearch": { +"enabled": True, +"connection": {"user": "admin", "host": "elastichostname", "port": 8080}, +} +} +) + +assert "http://elastichostname:8080"; == connection + +def test_url_generated_with_valid_user_password(self): +connection = self._get_connection( +{ +"elasticsearch": { +"enabled": True, +"connection": {"user": "admin", "pass": "pass", "host": "elastichostname", "port": 8080}, +} +} +) + +assert "http://admin:pass@elastichostname:8080"; == connection Review comment: Thanks, Im actually having problems passing JSON in parametrized.expand ``` @parameterized.expand( [ # When user is empty ({"enabled": True, "connection" : {"pass": "password", "host": "elastichostname", "port": 8080}}), # When pass is empty # ({"connection": {"user": "admin", "host": "elastichostname", "port": 8080}}), # # When user and pass are empty # ({"connection": {"host": "elastichostname", "port": 8080}}), ], )``` -- 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-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org