Merge ~hemanth-n/postgresql-charm:lp1956266 into postgresql-charm:master

Proposed by Hemanth Nakkina
Status: Superseded
Proposed branch: ~hemanth-n/postgresql-charm:lp1956266
Merge into: postgresql-charm:master
Diff against target: 36 lines (+5/-2)
2 files modified
reactive/postgresql/postgresql.py (+1/-1)
unit_tests/test_postgresql.py (+4/-1)
Reviewer Review Type Date Requested Status
Canonical IS Reviewers Pending
PostgreSQL Charm Maintainers Pending
Review via email: mp+413842@code.launchpad.net

This proposal has been superseded by a proposal from 2022-01-11.

Commit message

Fix regex to read extra_pg_config with dot in configuration parameters

To post a comment you must log in.
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

This merge proposal is being monitored by mergebot. Change the status to Approved to merge.

Revision history for this message
Tom Haddon (mthaddon) wrote :

Could we split this into a few different merge proposals, since there's the addition of data_sync_retry to pg_settings_10.json, some description changes/typo fixes, and extension_destdir addition in pg_settings_11.json which I think should be handled in a separate commit as they're unrelated to the dot configuration parameters and addition of pgaudit settings.

Unmerged commits

e0011ae... by Hemanth Nakkina

Fix regex to read extra_pg_config with dot

Fix regex to include parsing of dot in extra_pg_config
option.

Closes-Bug: #1956266

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/reactive/postgresql/postgresql.py b/reactive/postgresql/postgresql.py
index 7c5f440..c20705e 100644
--- a/reactive/postgresql/postgresql.py
+++ b/reactive/postgresql/postgresql.py
@@ -614,7 +614,7 @@ def parse_config(unparsed_config, fatal=True):
614 r"""^\s*614 r"""^\s*
615 ( # key=value (1)615 ( # key=value (1)
616 (?:616 (?:
617 (\w+) # key (2)617 ([.\w]+) # key (2)
618 (?:\s*=\s*|\s+) # separator618 (?:\s*=\s*|\s+) # separator
619 )?619 )?
620 (?:620 (?:
diff --git a/unit_tests/test_postgresql.py b/unit_tests/test_postgresql.py
index 9989318..c6ac803 100644
--- a/unit_tests/test_postgresql.py
+++ b/unit_tests/test_postgresql.py
@@ -580,6 +580,8 @@ class TestPostgresql(unittest.TestCase):
580 service_reload.assert_called_once_with('postgresql@9.9-main')580 service_reload.assert_called_once_with('postgresql@9.9-main')
581581
582 def test_parse_config(self):582 def test_parse_config(self):
583 dict_key_with_dot = dict()
584 dict_key_with_dot['key.10'] = '-1'
583 valid = [(r'# A comment', dict()),585 valid = [(r'# A comment', dict()),
584 (r'key_1 = value', dict(key_1='value')),586 (r'key_1 = value', dict(key_1='value')),
585 (r"key_2 ='quoted valu3'", dict(key_2='quoted valu3')),587 (r"key_2 ='quoted valu3'", dict(key_2='quoted valu3')),
@@ -591,7 +593,8 @@ class TestPostgresql(unittest.TestCase):
591 (r"key_6='#'", dict(key_6='#')),593 (r"key_6='#'", dict(key_6='#')),
592 (r"key_7=42", dict(key_7='42')),594 (r"key_7=42", dict(key_7='42')),
593 (r"key_8=3.142", dict(key_8='3.142')),595 (r"key_8=3.142", dict(key_8='3.142')),
594 (r'key_9=-1', dict(key_9='-1'))]596 (r'key_9=-1', dict(key_9='-1')),
597 (r'key.10=-1', dict_key_with_dot)]
595598
596 # The above examples all parse correctly.599 # The above examples all parse correctly.
597 for raw, expected in valid:600 for raw, expected in valid:

Subscribers

People subscribed via source and target branches

to all changes: