Skip to content

Commit 5c9dbb0

Browse files
committed
test: clean up imports and add assertions
1 parent a19bf48 commit 5c9dbb0

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

lib/vsc/utils/script_tools.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -307,23 +307,22 @@ def __init__(self, name=None):
307307
if isinstance(self, HAMixin):
308308
argparser = populate_config_parser(argparser, self.__class__.HA_MIXIN_OPTIONS)
309309

310+
if isinstance(self, LogMixin):
311+
argparser = populate_config_parser(argparser, self.__class__.LOG_MIXIN_OPTIONS)
312+
310313
if isinstance(self, TimestampMixin):
311314
argparser = populate_config_parser(argparser, self.__class__.TIMESTAMP_MIXIN_OPTIONS)
312315

313316
if isinstance(self, LockMixin):
314317
argparser = populate_config_parser(argparser, self.__class__.LOCK_MIXIN_OPTIONS)
315318

316-
if isinstance(self, LogMixin):
317-
argparser = populate_config_parser(argparser, self.__class__.LOG_MIXIN_OPTIONS)
318-
319319
if isinstance(self, NagiosStatusMixin):
320320
argparser = populate_config_parser(argparser, self.__class__.NAGIOS_MIXIN_OPTIONS)
321321

322322
argparser = populate_config_parser(argparser, self.get_options())
323323

324324
self.options = argparser.parse_args()
325325

326-
327326
def critical(self, msg):
328327
if isinstance(self, NagiosStatusMixin):
329328
self.nagios_epilogue(NAGIOS_CRITICAL, msg)
@@ -361,7 +360,7 @@ def main(self):
361360
#errors = []
362361

363362
msg = self.name
364-
if self.options.dry_run:
363+
if msg and self.options.dry_run:
365364
msg += " (dry-run)"
366365
logging.info("%s started.", msg)
367366

@@ -412,6 +411,9 @@ def main(self):
412411
if isinstance(self, NagiosStatusMixin):
413412
self.nagios_epilogue()
414413

414+
if isinstance(self, LogMixin):
415+
self.log_epilogue()
416+
415417

416418
class FullCLIBase(HAMixin, LockMixin, TimestampMixin, LogMixin, NagiosStatusMixin, CLIBase):
417419
"""
@@ -438,6 +440,12 @@ def _merge_options(options):
438440
return opts
439441

440442

443+
class CLI(FullCLIBase):
444+
445+
def __init__(self, name=None, default_options=None): # pylint: disable=unused-argument
446+
super().__init__(name)
447+
448+
441449
@deprecated_class("Base your scripts on the CLIBase class instead")
442450
class ExtendedSimpleOption(SimpleOption):
443451
"""
@@ -564,11 +572,6 @@ def critical_exception_handler(self, tp, value, traceback):
564572
self.critical(message)
565573

566574

567-
class CLI(FullCLIBase):
568-
569-
def __init__(self, name=None, default_options=None): # pylint: disable=unused-argument
570-
super().__init__(name)
571-
572575
@deprecated_class("Base your scripts on the CLIBase class instead")
573576
class OldCLI:
574577
"""

0 commit comments

Comments
 (0)