Set auth_plugin in __init__
This avoids auth_plugin being undefined when calling self.get_base_parser without self.main having been called. Closes-Bug: #1434264 Change-Id: Ic3a898ccecb865ff4e88d82538bcb04001d623db
This commit is contained in:
parent
1b346fb647
commit
2f238c6d97
|
@ -46,6 +46,9 @@ def _positive_non_zero_int(argument_value):
|
|||
|
||||
class CeilometerShell(object):
|
||||
|
||||
def __init__(self):
|
||||
self.auth_plugin = ceiloclient.AuthPlugin()
|
||||
|
||||
def get_base_parser(self):
|
||||
parser = argparse.ArgumentParser(
|
||||
prog='ceilometer',
|
||||
|
@ -158,7 +161,6 @@ class CeilometerShell(object):
|
|||
|
||||
def parse_args(self, argv):
|
||||
# Parse args once to find version
|
||||
self.auth_plugin = ceiloclient.AuthPlugin()
|
||||
parser = self.get_base_parser()
|
||||
(options, args) = parser.parse_known_args(argv)
|
||||
self.auth_plugin.parse_opts(options)
|
||||
|
|
|
@ -92,6 +92,11 @@ class ShellHelpTest(ShellTestBase):
|
|||
self.assertThat(help_text,
|
||||
matchers.MatchesRegex(r, self.RE_OPTIONS))
|
||||
|
||||
def test_get_base_parser(self):
|
||||
standalone_shell = ceilometer_shell.CeilometerShell()
|
||||
parser = standalone_shell.get_base_parser()
|
||||
self.assertEqual(600, parser.get_default('timeout'))
|
||||
|
||||
|
||||
class ShellKeystoneV2Test(ShellTestBase):
|
||||
|
||||
|
|
Loading…
Reference in New Issue