Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
richardtief committed Nov 27, 2020
1 parent 1ebeb07 commit 71a6e60
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
6 changes: 3 additions & 3 deletions exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ def parse_params(logger):
os.environ['RUBRIC'] = options.rubric

if "PORT" not in os.environ and not options.port:
logger.error(f'Can not start, please specify port with ENV or -o')
logger.error(f'Cannot start, please specify port with ENV or -o')
sys.exit(0)
if "INVENTORY" not in os.environ and not options.inventory:
logger.error(f'Can not start, please specify inventory with ENV or -i')
logger.error(f'Cannot start, please specify inventory with ENV or -i')
sys.exit(0)
if "CONFIG" not in os.environ and not options.config:
logger.error(f'Can not start, please specify collector config with ENV or -m')
logger.error(f'Cannot start, please specify collector config with ENV or -m')
sys.exit(0)

return options
Expand Down
3 changes: 1 addition & 2 deletions tests/TestLaunchExporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ class TestLaunchExporter(TestCase):

# test with debug option on
def test_with_cli_params_1(self):

sys.argv = ['prog', '-o', '1234', '-i', 'inventory.some.url', '-m', 'tests/collector_config.yaml', '-t',
'testhost.test']
parse_params(logger=logger)
parse_params(logger)
self.assertEqual(os.getenv('PORT'), '1234', 'The port was not set correctly!')
self.assertEqual(os.getenv('INVENTORY'), 'inventory.some.url', 'Inventory was not set correctly')
self.assertEqual(os.getenv('CONFIG'), 'tests/collector_config.yaml', 'Config was not set')
Expand Down

0 comments on commit 71a6e60

Please sign in to comment.