Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] napalm: net.load_template does not work #60515

Open
ichilton opened this issue Jul 9, 2021 · 2 comments · May be fixed by #67715
Open

[BUG] napalm: net.load_template does not work #60515

ichilton opened this issue Jul 9, 2021 · 2 comments · May be fixed by #67715
Labels
Bug broken, incorrect, or confusing behavior Proxy-Minion
Milestone

Comments

@ichilton
Copy link

ichilton commented Jul 9, 2021

Description
I get the following error when trying to use net.load_template.

root@network-master:~# salt test-se1 net.load_template template_source='ntp server 192.168.1.100' test=true
test-se1:
    The minion function caused an exception: Traceback (most recent call last):
      File "/usr/lib/python3/dist-packages/salt/metaproxy/proxy.py", line 475, in thread_return
        opts, data, func, args, kwargs
      File "/usr/lib/python3/dist-packages/salt/loader.py", line 1241, in __call__
        return self.loader.run(run_func, *args, **kwargs)
      File "/usr/lib/python3/dist-packages/salt/loader.py", line 2274, in run
        return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
      File "/usr/lib/python3/dist-packages/salt/loader.py", line 2289, in _run_as
        return _func_or_method(*args, **kwargs)
      File "/usr/lib/python3/dist-packages/salt/executors/direct_call.py", line 12, in execute
        return func(*args, **kwargs)
      File "/usr/lib/python3/dist-packages/salt/loader.py", line 1241, in __call__
        return self.loader.run(run_func, *args, **kwargs)
      File "/usr/lib/python3/dist-packages/salt/loader.py", line 2274, in run
        return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
      File "/usr/lib/python3/dist-packages/salt/loader.py", line 2289, in _run_as
        return _func_or_method(*args, **kwargs)
      File "/usr/lib/python3/dist-packages/salt/utils/napalm.py", line 508, in func_wrapper
        ret = func(*args, **kwargs)
      File "/usr/lib/python3/dist-packages/salt/modules/napalm_network.py", line 1958, in load_template
        salt_render = salt_render or template_name.startswith(
    AttributeError: 'NoneType' object has no attribute 'startswith'
ERROR: Minions returned with non-zero exit code

Setup

I have a working salt-master / salt-proxy setup, talking to Arista EOS devices:

root@network-master:~# salt test-se1 net.connected
test-se1:
    ----------
    out:
        True

Steps to Reproduce the behavior

Any net.load_template template_source='command' command seems to fail.

Expected behavior

It should apply the config without error.

Screenshots

n/a

Versions Report

salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
Salt Version:
          Salt: 3003.1

Dependency Versions:
          cffi: Not Installed
      cherrypy: Not Installed
      dateutil: 2.7.3
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 2.10
       libgit2: 0.27.7
      M2Crypto: 0.31.0
          Mako: Not Installed
       msgpack: 0.5.6
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     pycparser: 2.19
      pycrypto: 2.6.1
  pycryptodome: 3.6.1
        pygit2: 0.27.4
        Python: 3.7.3 (default, Jan 22 2021, 20:04:44)
  python-gnupg: Not Installed
        PyYAML: 3.13
         PyZMQ: 17.1.2
         smmap: Not Installed
       timelib: Not Installed
       Tornado: 4.5.3
           ZMQ: 4.3.1

System Versions:
          dist: debian 10 buster
        locale: UTF-8
       machine: x86_64
       release: 4.19.0-16-amd64
        system: Linux
       version: Debian GNU/Linux 10 buster

Additional context

cc: @mirceaulinic who I think wrote this?

Thanks!

Ian

@ichilton ichilton added Bug broken, incorrect, or confusing behavior needs-triage labels Jul 9, 2021
@garethgreenaway garethgreenaway added this to the Approved milestone Jul 14, 2021
@garethgreenaway
Copy link
Contributor

@ichilton Thanks for the report. Looks like we're simply not accounting for the possibility that template_name has not been passed.

@ichilton
Copy link
Author

@ichilton Thanks for the report. Looks like we're simply not accounting for the possibility that template_name has not been passed.

@garethgreenaway Were you ever able to take a look at this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior Proxy-Minion
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants