Merge ~ack/maas:snap-init-no-user-authconfig-params into maas:master

Proposed by Alberto Donato
Status: Merged
Approved by: Alberto Donato
Approved revision: 21b3a30125dea930623ad47e00dd6cadbd4aa4ae
Merge reported by: MAAS Lander
Merged at revision: not available
Proposed branch: ~ack/maas:snap-init-no-user-authconfig-params
Merge into: maas:master
Diff against target: 210 lines (+63/-29)
2 files modified
src/maascli/init.py (+38/-12)
src/maascli/snappy.py (+25/-17)
Reviewer Review Type Date Requested Status
MAAS Lander Needs Fixing
Björn Tillenius Approve
Review via email: mp+384239@code.launchpad.net

Commit message

LP: #1871356 - snap: hide maas init parameters for creating admin and configuring auth

To post a comment you must log in.
Revision history for this message
Björn Tillenius (bjornt) wrote :

+1

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

LANDING
-b snap-init-no-user-authconfig-params lp:~ack/maas/+git/maas into -b master lp:~maas-committers/maas

STATUS: FAILED BUILD
LOG: http://maas-ci.internal:8080/job/maas/job/branch-tester/7556/consoleText

Revision history for this message
MAAS Lander (maas-lander) wrote :

UNIT TESTS
-b snap-init-no-user-authconfig-params lp:~ack/maas/+git/maas into -b master lp:~maas-committers/maas

STATUS: FAILED
LOG: http://maas-ci.internal:8080/job/maas/job/branch-tester/7557/console
COMMIT: 21b3a30125dea930623ad47e00dd6cadbd4aa4ae

review: Needs Fixing

There was an error fetching revisions from git servers. Please try again in a few minutes. If the problem persists, contact Launchpad support.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/src/maascli/init.py b/src/maascli/init.py
index 789dfca..ac36e6c 100644
--- a/src/maascli/init.py
+++ b/src/maascli/init.py
@@ -55,68 +55,94 @@ def deprecated_for(new_option):
55 return DeprecatedAction55 return DeprecatedAction
5656
5757
58def add_candid_options(parser):58def add_candid_options(parser, suppress_help=False):
59 parser.add_argument(59 parser.add_argument(
60 "--candid-agent-file",60 "--candid-agent-file",
61 help="Agent file containing Candid authentication information",61 help=(
62 argparse.SUPPRESS
63 if suppress_help
64 else "Agent file containing Candid authentication information"
65 ),
62 )66 )
63 parser.add_argument(67 parser.add_argument(
64 "--candid-domain",68 "--candid-domain",
65 default=None,69 default=None,
66 help=(70 help=(
67 "The authentication domain to look up users in for the external "71 argparse.SUPPRESS
72 if suppress_help
73 else "The authentication domain to look up users in for the external "
68 "Candid server."74 "Candid server."
69 ),75 ),
70 )76 )
71 parser.add_argument(77 parser.add_argument(
72 "--candid-admin-group",78 "--candid-admin-group",
73 default=None,79 default=None,
74 help="Group of users whose members are made admins in MAAS",80 help=(
81 argparse.SUPPRESS
82 if suppress_help
83 else "Group of users whose members are made admins in MAAS"
84 ),
75 )85 )
7686
7787
78def add_rbac_options(parser):88def add_rbac_options(parser, suppress_help=False):
79 parser.add_argument(89 parser.add_argument(
80 "--rbac-url",90 "--rbac-url",
81 default=None,91 default=None,
82 help="The URL for the Canonical RBAC service to use.",92 help=(
93 argparse.SUPPRESS
94 if suppress_help
95 else "The URL for the Canonical RBAC service to use."
96 ),
83 )97 )
84 parser.add_argument(98 parser.add_argument(
85 "--rbac-service-name",99 "--rbac-service-name",
86 default=None,100 default=None,
87 help=(101 help=(
88 "Optionally, the name of the RBAC service to register this MAAS "102 argparse.SUPPRESS
103 if suppress_help
104 else "Optionally, the name of the RBAC service to register this MAAS "
89 "as. If not provided, a list with services that the user can "105 "as. If not provided, a list with services that the user can "
90 "register will be displayed, to choose from."106 "register will be displayed, to choose from."
91 ),107 ),
92 )108 )
93109
94110
95def add_create_admin_options(parser):111def add_create_admin_options(parser, suppress_help=False):
96 parser.add_argument(112 parser.add_argument(
97 "--admin-username",113 "--admin-username",
98 default=None,114 default=None,
99 metavar="USERNAME",115 metavar="USERNAME",
100 help="Username for the admin account.",116 help=argparse.SUPPRESS
117 if suppress_help
118 else "Username for the admin account.",
101 )119 )
102 parser.add_argument(120 parser.add_argument(
103 "--admin-password",121 "--admin-password",
104 default=None,122 default=None,
105 metavar="PASSWORD",123 metavar="PASSWORD",
106 help="Force a given admin password instead of prompting.",124 help=(
125 argparse.SUPPRESS
126 if suppress_help
127 else "Force a given admin password instead of prompting."
128 ),
107 )129 )
108 parser.add_argument(130 parser.add_argument(
109 "--admin-email",131 "--admin-email",
110 default=None,132 default=None,
111 metavar="EMAIL",133 metavar="EMAIL",
112 help="Email address for the admin.",134 help=argparse.SUPPRESS
135 if suppress_help
136 else "Email address for the admin.",
113 )137 )
114 parser.add_argument(138 parser.add_argument(
115 "--admin-ssh-import",139 "--admin-ssh-import",
116 default=None,140 default=None,
117 metavar="LP_GH_USERNAME",141 metavar="LP_GH_USERNAME",
118 help=(142 help=(
119 "Import SSH keys from Launchpad (lp:user-id) or "143 argparse.SUPPRESS
144 if suppress_help
145 else "Import SSH keys from Launchpad (lp:user-id) or "
120 "Github (gh:user-id) for the admin."146 "Github (gh:user-id) for the admin."
121 ),147 ),
122 )148 )
diff --git a/src/maascli/snappy.py b/src/maascli/snappy.py
index a3ba92c..1507d52 100644
--- a/src/maascli/snappy.py
+++ b/src/maascli/snappy.py
@@ -23,6 +23,7 @@ import signal
23import string23import string
24import subprocess24import subprocess
25import sys25import sys
26from textwrap import dedent
26import threading27import threading
27import time28import time
2829
@@ -623,6 +624,7 @@ def perform_work(msg, cmd, *args, **kwargs):
623 finally:624 finally:
624 evnt.set()625 evnt.set()
625 t.join()626 t.join()
627 clear_line()
626 return ret628 return ret
627629
628630
@@ -879,22 +881,17 @@ class cmd_init(SnappyCommand):
879 "--enable-candid",881 "--enable-candid",
880 default=False,882 default=False,
881 action="store_true",883 action="store_true",
882 help=(884 help=argparse.SUPPRESS,
883 "Enable configuring the use of an external Candid server. "
884 "This feature is currently experimental. "
885 "If this isn't enabled, all --candid-* arguments "
886 "will be ignored."
887 ),
888 )885 )
889 for for_mode in ["region+rack", "region"]:886 for for_mode in ["region+rack", "region"]:
890 add_candid_options(subparsers_map[for_mode])887 add_candid_options(subparsers_map[for_mode], suppress_help=True)
891 add_rbac_options(subparsers_map[for_mode])888 add_rbac_options(subparsers_map[for_mode], suppress_help=True)
892 subparsers_map[for_mode].add_argument(889 subparsers_map[for_mode].add_argument(
893 "--skip-admin",890 "--skip-admin", action="store_true", help=argparse.SUPPRESS
894 action="store_true",891 )
895 help="Skip the admin creation.",892 add_create_admin_options(
893 subparsers_map[for_mode], suppress_help=True
896 )894 )
897 add_create_admin_options(subparsers_map[for_mode])
898895
899 def handle(self, options):896 def handle(self, options):
900 if os.getuid() != 0:897 if os.getuid() != 0:
@@ -1021,7 +1018,6 @@ class cmd_init(SnappyCommand):
1021 migrate_db,1018 migrate_db,
1022 capture=sys.stdout.isatty(),1019 capture=sys.stdout.isatty(),
1023 )1020 )
1024 clear_line()
1025 init_maas(options)1021 init_maas(options)
1026 elif mode in ["region", "region+rack"]:1022 elif mode in ["region", "region+rack"]:
1027 # When in 'region' or 'region+rack' the migrations for the database1023 # When in 'region' or 'region+rack' the migrations for the database
@@ -1031,8 +1027,22 @@ class cmd_init(SnappyCommand):
1031 migrate_db,1027 migrate_db,
1032 capture=sys.stdout.isatty(),1028 capture=sys.stdout.isatty(),
1033 )1029 )
1034 else:1030 print_msg(
1035 clear_line()1031 dedent(
1032 """\
1033 MAAS has been set up.
1034
1035 If you want to configure external authentication or use
1036 MAAS with Canonical RBAC, please run
1037
1038 sudo maas configauth
1039
1040 To create admins when not using external authentication, run
1041
1042 sudo maas createadmin
1043 """
1044 )
1045 )
10361046
10371047
1038class cmd_config(SnappyCommand):1048class cmd_config(SnappyCommand):
@@ -1315,7 +1325,6 @@ class cmd_config(SnappyCommand):
1315 else "Stopping services",1325 else "Stopping services",
1316 sighup_supervisord,1326 sighup_supervisord,
1317 )1327 )
1318 clear_line()
13191328
1320 # Perform migrations when switching to all.1329 # Perform migrations when switching to all.
1321 if changed_to_all:1330 if changed_to_all:
@@ -1325,7 +1334,6 @@ class cmd_config(SnappyCommand):
1325 migrate_db,1334 migrate_db,
1326 capture=sys.stdout.isatty(),1335 capture=sys.stdout.isatty(),
1327 )1336 )
1328 clear_line()
13291337
13301338
1331class cmd_status(SnappyCommand):1339class cmd_status(SnappyCommand):

Subscribers

People subscribed via source and target branches