jeremyschulman / netcfgbu

Network Configuration Backup
Apache License 2.0
105 stars 15 forks source link

BUG: APP_CFG os_name None #45

Closed minitriga closed 4 years ago

minitriga commented 4 years ago

Hitting a bug where os_name is None after it goes through validation.

(venv) axians@ubuntu-automation:~/netcfgbu$ netcfgbu login
Traceback (most recent call last):
  File "/home/axians/netcfgbu/venv/bin/netcfgbu", line 7, in <module>
    exec(compile(f.read(), __file__, 'exec'))
  File "/home/axians/netcfgbu/bin/netcfgbu", line 6, in <module>
    main.run()
  File "/home/axians/netcfgbu/netcfgbu/cli/main.py", line 11, in run
    cli(obj={})
  File "/home/axians/netcfgbu/venv/lib/python3.8/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/home/axians/netcfgbu/venv/lib/python3.8/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/axians/netcfgbu/venv/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/axians/netcfgbu/netcfgbu/cli/root.py", line 66, in invoke
    super().invoke(ctx)
  File "/home/axians/netcfgbu/venv/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/axians/netcfgbu/venv/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/axians/netcfgbu/venv/lib/python3.8/site-packages/click/decorators.py", line 21, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/axians/netcfgbu/netcfgbu/cli/login.py", line 84, in cli_login
    exec_test_login(ctx.obj["app_cfg"], ctx.obj["inventory_recs"], cli_opts)
  File "/home/axians/netcfgbu/netcfgbu/cli/login.py", line 25, in exec_test_login
    login_tasks = {
  File "/home/axians/netcfgbu/netcfgbu/cli/login.py", line 26, in <dictcomp>
    make_host_connector(rec, app_cfg).test_login(timeout=cli_opts["timeout"]): rec
  File "/home/axians/netcfgbu/netcfgbu/os_specs/__init__.py", line 11, in make_host_connector
    os_spec_def = get_os_spec(rec, app_cfg)
  File "/home/axians/netcfgbu/netcfgbu/os_specs/__init__.py", line 7, in get_os_spec
    return app_cfg.os_name.get(os_name) or OSNameSpec()
AttributeError: 'NoneType' object has no attribute 'get'

Jeremy found the issue within config_model.py whereby v needed to be returned on line 162.

Cheers for looking into this issue @jeremyschulman.

jeremyschulman commented 4 years ago

@minitriga - thank you for the report and working me to triage. I will be releasing the v0.3.1 shortly with this fix.

jeremyschulman commented 4 years ago

merged to master and released https://github.com/jeremyschulman/netcfgbu/releases/tag/v0.3.1