Merge ~andreserl/maas:lp1809321_database_port_snap into maas:master

Proposed by Andres Rodriguez
Status: Merged
Approved by: Andres Rodriguez
Approved revision: ef7a64ce1533048f97029f17270b4d116f4aa702
Merge reported by: MAAS Lander
Merged at revision: not available
Proposed branch: ~andreserl/maas:lp1809321_database_port_snap
Merge into: maas:master
Diff against target: 52 lines (+21/-6)
1 file modified
src/maascli/snappy.py (+21/-6)
Reviewer Review Type Date Requested Status
MAAS Lander Approve
Andres Rodriguez (community) Approve
Blake Rouse (community) Approve
Review via email: mp+363222@code.launchpad.net

Commit message

LP: #1809321 - Add --database-port as an optional option for the snap

To post a comment you must log in.
Revision history for this message
MAAS Lander (maas-lander) wrote :

UNIT TESTS
-b lp1809321_database_port_snap lp:~andreserl/maas/+git/maas into -b master lp:~maas-committers/maas

STATUS: FAILED
LOG: http://maas-ci-jenkins.internal:8080/job/maas/job/branch-tester/5078/console
COMMIT: 137bef6f0ee61ab3f0f91cecb7a394695d13d4ca

review: Needs Fixing
Revision history for this message
Blake Rouse (blake-rouse) wrote :

Looks good!

review: Approve
Revision history for this message
MAAS Lander (maas-lander) wrote :
Revision history for this message
MAAS Lander (maas-lander) wrote :
Revision history for this message
MAAS Lander (maas-lander) wrote :
Revision history for this message
Andres Rodriguez (andreserl) :
review: Approve
Revision history for this message
MAAS Lander (maas-lander) wrote :
Revision history for this message
MAAS Lander (maas-lander) wrote :

UNIT TESTS
-b lp1809321_database_port_snap lp:~andreserl/maas/+git/maas into -b master lp:~maas-committers/maas

STATUS: SUCCESS
COMMIT: ef7a64ce1533048f97029f17270b4d116f4aa702

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/src/maascli/snappy.py b/src/maascli/snappy.py
2index 4779f0d..b381b5b 100755
3--- a/src/maascli/snappy.py
4+++ b/src/maascli/snappy.py
5@@ -73,6 +73,12 @@ ARGUMENTS = OrderedDict([
6 'the database. Only used when in \'region+rack\' or '
7 '\'region\' mode.'),
8 }),
9+ ('database-port', {
10+ 'help': (
11+ 'Optional option to set the port that should be used to '
12+ 'communicate to the database. Only used when in '
13+ '\'region+rack\' or \'region\' mode.'),
14+ }),
15 ('database-name', {
16 'help': (
17 'Database name for MAAS to use. Only used when in '
18@@ -276,6 +282,7 @@ def print_config(
19 print_config_value(config, 'maas_url')
20 if current_mode in ['region+rack', 'region']:
21 print_config_value(config, 'database_host')
22+ print_config_value(config, 'database_port')
23 print_config_value(config, 'database_name')
24 print_config_value(config, 'database_user')
25 print_config_value(
26@@ -688,12 +695,20 @@ class cmd_init(SnappyCommand):
27 perform_work('Stopping services', stop_services)
28
29 # Configure the settings.
30- MAASConfiguration().update(
31- {'maas_url': maas_url,
32- 'database_host': database_host,
33- 'database_name': database_name,
34- 'database_user': database_user,
35- 'database_pass': database_pass})
36+ settings = {
37+ 'maas_url': maas_url,
38+ 'database_host': database_host,
39+ 'database_name': database_name,
40+ 'database_user': database_user,
41+ 'database_pass': database_pass}
42+
43+ # Add the port to the configuration if exists. By default
44+ # MAAS handles picking the port automatically in the backend
45+ # if none provided.
46+ if options.database_port:
47+ settings['database_port'] = options.database_port
48+
49+ MAASConfiguration().update(settings)
50 set_rpc_secret(rpc_secret)
51
52 # Finalize the Initialization.

Subscribers

People subscribed via source and target branches