|
31 | 31 | from openstackclient.common import clientmanager |
32 | 32 | from openstackclient.common import commandmanager |
33 | 33 | from openstackclient.common import exceptions as exc |
34 | | -from openstackclient.common import openstackkeyring |
35 | 34 | from openstackclient.common import restapi |
36 | 35 | from openstackclient.common import utils |
37 | 36 | from openstackclient.identity import client as identity_client |
@@ -305,18 +304,6 @@ def build_option_parser(self, description, version): |
305 | 304 | default=env('OS_URL'), |
306 | 305 | help='Defaults to env[OS_URL]') |
307 | 306 |
|
308 | | - env_os_keyring = env('OS_USE_KEYRING', default=False) |
309 | | - if type(env_os_keyring) == str: |
310 | | - if env_os_keyring.lower() in ['true', '1']: |
311 | | - env_os_keyring = True |
312 | | - else: |
313 | | - env_os_keyring = False |
314 | | - parser.add_argument('--os-use-keyring', |
315 | | - default=env_os_keyring, |
316 | | - action='store_true', |
317 | | - help='Use keyring to store password, ' |
318 | | - 'default=False (Env: OS_USE_KEYRING)') |
319 | | - |
320 | 307 | parser.add_argument( |
321 | 308 | '--os-identity-api-version', |
322 | 309 | metavar='<identity-api-version>', |
@@ -359,14 +346,12 @@ def authenticate_user(self): |
359 | 346 | "You must provide a username via" |
360 | 347 | " either --os-username or env[OS_USERNAME]") |
361 | 348 |
|
362 | | - self.get_password_from_keyring() |
363 | 349 | if not self.options.os_password: |
364 | 350 | # No password, if we've got a tty, try prompting for it |
365 | 351 | if hasattr(sys.stdin, 'isatty') and sys.stdin.isatty(): |
366 | 352 | # Check for Ctl-D |
367 | 353 | try: |
368 | 354 | self.options.os_password = getpass.getpass() |
369 | | - self.set_password_in_keyring() |
370 | 355 | except EOFError: |
371 | 356 | pass |
372 | 357 | # No password because we did't have a tty or the |
@@ -430,34 +415,6 @@ def authenticate_user(self): |
430 | 415 | ) |
431 | 416 | return |
432 | 417 |
|
433 | | - def init_keyring_backend(self): |
434 | | - """Initialize openstack backend to use for keyring""" |
435 | | - return openstackkeyring.os_keyring() |
436 | | - |
437 | | - def get_password_from_keyring(self): |
438 | | - """Get password from keyring, if it's set""" |
439 | | - if self.options.os_use_keyring: |
440 | | - service = KEYRING_SERVICE |
441 | | - backend = self.init_keyring_backend() |
442 | | - if not self.options.os_password: |
443 | | - password = backend.get_password(service, |
444 | | - self.options.os_username) |
445 | | - self.options.os_password = password |
446 | | - |
447 | | - def set_password_in_keyring(self): |
448 | | - """Set password in keyring for this user""" |
449 | | - if self.options.os_use_keyring: |
450 | | - service = KEYRING_SERVICE |
451 | | - backend = self.init_keyring_backend() |
452 | | - if self.options.os_password: |
453 | | - password = backend.get_password(service, |
454 | | - self.options.os_username) |
455 | | - # either password is not set in keyring, or it is different |
456 | | - if password != self.options.os_password: |
457 | | - backend.set_password(service, |
458 | | - self.options.os_username, |
459 | | - self.options.os_password) |
460 | | - |
461 | 418 | def initialize_app(self, argv): |
462 | 419 | """Global app init bits: |
463 | 420 |
|
|
0 commit comments