There was an error while loading. Please reload this page.
2 parents f6f5a70 + ce1013d commit a836434Copy full SHA for a836434
2 files changed
cinderclient/shell.py
@@ -140,15 +140,17 @@ def get_base_parser(self):
140
parser.add_argument('--os-auth-system',
141
metavar='<os-auth-system>',
142
dest='os_auth_type',
143
- default=utils.env('OS_AUTH_SYSTEM'),
+ default=(utils.env('OS_AUTH_TYPE') or
144
+ utils.env('OS_AUTH_SYSTEM')),
145
help=_('DEPRECATED! Use --os-auth-type. '
146
'Defaults to env[OS_AUTH_SYSTEM].'))
147
parser.add_argument('--os_auth_system',
148
help=argparse.SUPPRESS)
149
parser.add_argument('--os-auth-type',
150
metavar='<os-auth-type>',
151
- default=utils.env('OS_AUTH_TYPE'),
152
153
154
help=_('Defaults to env[OS_AUTH_TYPE].'))
155
parser.add_argument('--os_auth_type',
156
cinderclient/tests/unit/test_shell.py
@@ -72,6 +72,26 @@ def shell(self, argstr):
72
73
return out
74
75
+ def test_default_auth_env(self):
76
+ _shell = shell.OpenStackCinderShell()
77
+ args, __ = _shell.get_base_parser().parse_known_args([])
78
+ self.assertEqual('', args.os_auth_type)
79
+
80
+ def test_auth_type_env(self):
81
+ self.make_env(exclude='OS_PASSWORD',
82
+ include={'OS_AUTH_SYSTEM': 'non existent auth',
83
+ 'OS_AUTH_TYPE': 'noauth'})
84
85
86
+ self.assertEqual('noauth', args.os_auth_type)
87
88
+ def test_auth_system_env(self):
89
90
+ include={'OS_AUTH_SYSTEM': 'noauth'})
91
92
93
94
95
def test_help_unknown_command(self):
96
self.assertRaises(exceptions.CommandError, self.shell, 'help foofoo')
97
0 commit comments