Juniper/salt

salt execution module junos.load and junos.install_config with invalid config files throws exception AttributeError: 'bool' object has no attribute 'read

Closed this issue · 2 comments

Description of Issue/Question

On executing junos.load or junos.install_config with invalid path, the salt template renderer produces the following traceback

salt "vmx1" junos.load salt://baseline-config.conf

vmx1:
    The minion function caused an exception: Traceback (most recent call last):
      File "/usr/local/lib/python3.4/dist-packages/salt/minion.py", line 1660, in _thread_return
        return_data = minion_instance.executors[fname](opts, data, func, args, kwargs)
      File "/usr/local/lib/python3.4/dist-packages/salt/executors/direct_call.py", line 12, in execute
        return func(*args, **kwargs)
      File "/usr/local/lib/python3.4/dist-packages/salt/modules/junos.py", line 1306, in load
        template_vars=template_vars)
      File "/usr/local/lib/python3.4/dist-packages/salt/modules/cp.py", line 348, in get_template
        **kwargs)
      File "/usr/local/lib/python3.4/dist-packages/salt/fileclient.py", line 743, in get_template
        **kwargs
      File "/usr/local/lib/python3.4/dist-packages/salt/utils/templates.py", line 166, in render_tmpl
        tmplstr = tmplsrc.read()
    AttributeError: 'bool' object has no attribute 'read'
ERROR: Minions returned with non-zero exit code


salt "vmx1" junos.install_config salt://baseline-config.conf overwrite=True 

vmx1:
    The minion function caused an exception: Traceback (most recent call last):
      File "/usr/local/lib/python3.4/dist-packages/salt/minion.py", line 1660, in _thread_return
        return_data = minion_instance.executors[fname](opts, data, func, args, kwargs)
      File "/usr/local/lib/python3.4/dist-packages/salt/executors/direct_call.py", line 12, in execute
        return func(*args, **kwargs)
      File "/usr/local/lib/python3.4/dist-packages/salt/modules/junos.py", line 99, in wrapper
        return function(*args, **kwargs)
      File "/usr/local/lib/python3.4/dist-packages/salt/modules/junos.py", line 882, in install_config
        template_vars=template_vars)
      File "/usr/local/lib/python3.4/dist-packages/salt/modules/cp.py", line 348, in get_template
        **kwargs)
      File "/usr/local/lib/python3.4/dist-packages/salt/fileclient.py", line 743, in get_template
        **kwargs
      File "/usr/local/lib/python3.4/dist-packages/salt/utils/templates.py", line 166, in render_tmpl
        tmplstr = tmplsrc.read()
    AttributeError: 'bool' object has no attribute 'read'
ERROR: Minions returned with non-zero exit code

Internal Tracking PR: 1428521

Closed PR: 1428521