@@ -124,24 +124,10 @@ def build_option_parser(self, description, version):
124124
125125 return parser
126126
127- def initialize_app (self ):
128- """Global app init bits:
129-
130- * set up API versions
131- * validate authentication info
132- * authenticate against Identity if requested
127+ def authenticate_user (self ):
128+ """Make sure the user has provided all of the authentication
129+ info we need.
133130 """
134-
135- super (OpenStackShell , self ).initialize_app ()
136-
137- # stash selected API versions for later
138- # TODO(dtroyer): how do extenstions add their version requirements?
139- self .api_version = {
140- 'compute' : self .options .os_compute_api_version ,
141- 'identity' : self .options .os_identity_api_version ,
142- 'image' : self .options .os_image_api_version ,
143- }
144-
145131 self .log .debug ('validating authentication options' )
146132 if self .options .os_token or self .options .os_url :
147133 # Token flow auth takes priority
@@ -190,6 +176,32 @@ def initialize_app(self):
190176 compute_api_version = self .options .os_compute_api_version ,
191177 image_api_version = self .options .os_image_api_version ,
192178 )
179+ return
180+
181+ def initialize_app (self , argv ):
182+ """Global app init bits:
183+
184+ * set up API versions
185+ * validate authentication info
186+ * authenticate against Identity if requested
187+ """
188+
189+ super (OpenStackShell , self ).initialize_app (argv )
190+
191+ # stash selected API versions for later
192+ # TODO(dtroyer): how do extenstions add their version requirements?
193+ self .api_version = {
194+ 'compute' : self .options .os_compute_api_version ,
195+ 'identity' : self .options .os_identity_api_version ,
196+ 'image' : self .options .os_image_api_version ,
197+ }
198+
199+ # If the user is not asking for help, make sure they
200+ # have given us auth.
201+ cmd_info = self .command_manager .find_command (argv )
202+ cmd_factory , cmd_name , sub_argv = cmd_info
203+ if cmd_name != 'help' :
204+ self .authenticate_user ()
193205
194206 self .log .debug ("API: Identity=%s Compute=%s Image=%s" % (
195207 self .api_version ['identity' ],
0 commit comments