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

<junos_install_config> "exceptions.ValueError " Error when using overwrite on ex-vc using *.set config file #232

Closed
mamathac opened this issue May 29, 2014 · 9 comments
Assignees
Milestone

Comments

@mamathac
Copy link

<junos_install_config>

Model : EX VC

Ansible Playbook:

  • name: Replace Config on Devices
    hosts: all
    connection: local
    gather_facts: yes
    vars:
    timeout: 300
    tasks:
    • name: 'config ... {{ file }}'
      junos_install_config:
      host={{ inventory_hostname }}
      file=/usr/local/junos/config/triplane_policy.set
      timeout=300
      overwrite='yes'
      logfile={{logdir}}/config.log

Result:
failed: [triplane] => {"changed": false, "failed": true, "file": "/usr/local/junos/config/triplane_policy.set"}
msg: Unable to make changes

FATAL: all hosts have already failed -- aborting

PLAY RECAP ***************************************************************

Log File:

2014-05-29 14:42:23,555:CONFIG:triplane:connecting to host: regress@triplane
2014-05-29 14:42:29,951:CONFIG:triplane:pushing file: /usr/local/junos/config/triplane_policy.set
2014-05-29 14:42:29,951:CONFIG:triplane:taking lock
2014-05-29 14:42:30,015:CONFIG:triplane:loading config
2014-05-29 14:42:30,016:CONFIG:triplane:'exceptions.ValueError' object has no attribute 'rsp'

Works fine when loaded manually.
Overwrite flag set could be the issue, since merge config is working fine

@mamathac
Copy link
Author

Opened in error. Config had protected interfaces.

@jeremyschulman
Copy link
Contributor

if this is reproducible, we should investigate issue and identify root cause.

@mamathac
Copy link
Author

Issue is reproducible everytime.
I saved the config as set commands on device using ||
regress@triplane> show configuration | display set | save /var/tmp/triplane_noprotect.set
Wrote 238 lines of output to '/var/tmp/triplane_noprotect.set'
Rolled back to previous config where policies were not there.

Installed this config with policies and got the error.

regress@vm-nomadic-ubuntu:~/ansible_junos/mydir_ansible/pb$ ansible-playbook replace_config --limit triplane -v

PLAY [Replace Config on Devices] **********************************************

GATHERING FACTS ***************************************************************
ok: [triplane]

TASK: [config ... {{file}}] ***************************************************
failed: [triplane] => {"changed": false, "failed": true, "file": "/usr/local/junos/config/triplane_noprotect.set"}
msg: Unable to make changes

FATAL: all hosts have already failed -- aborting

PLAY RECAP ********************************************************************
to retry, use: --limit @/home/regress/replace_config.retry

triplane : ok=1 changed=0 unreachable=0 failed=1

regress@vm-nomadic-ubuntu:~/ansible_junos/mydir_ansible/pb$

regress@vm-nomadic-ubuntu:/usr/local/junos/log$ tail -f config.log
2014-05-30 09:14:48,197:CONFIG:triplane:connecting to host: regress@triplane
2014-05-30 09:14:55,017:CONFIG:triplane:pushing file: /usr/local/junos/config/only_policy.set
2014-05-30 09:14:55,017:CONFIG:triplane:taking lock
2014-05-30 09:14:55,081:CONFIG:triplane:loading config
2014-05-30 09:14:55,762:CONFIG:triplane:committing change, please be patient
2014-05-30 09:15:06,353:CONFIG:triplane:unlocking
2014-05-30 09:15:06,468:CONFIG:triplane:change completed
2014-05-30 09:18:24,603:CONFIG:triplane:connecting to host: regress@triplane
2014-05-30 09:18:30,883:CONFIG:triplane:pushing file: /usr/local/junos/config/triplane_noprotect.set
2014-05-30 09:18:30,883:CONFIG:triplane:taking lock
2014-05-30 09:18:30,998:CONFIG:triplane:loading config
2014-05-30 09:18:30,998:CONFIG:triplane:'exceptions.ValueError' object has no attribute 'rsp'

@vnitinv
Copy link
Contributor

vnitinv commented May 30, 2014

I did a look into this:

  1. User is using .set file with overwrite=True, which is not a valid scenario hence https://github.com/Juniper/py-junos-eznc/blob/master/lib/jnpr/junos/utils/config.py#L211
    throws ValueError.
    ValueError: conflicting args, cannot use 'set' with 'overwrite'
  2. When using ansible this exception is caught at
    https://github.com/Juniper/ansible-junos-stdlib/blob/master/library/junos_install_config#L159-L160
    but as 1 gave ValueError hence err.rsp.find('.//ok') throws 'exceptions.ValueError' object has no attribute 'rsp'
  3. So user need to make sure set and overwrite True are not mixed. or the other way will be to catch ValueError too for https://github.com/Juniper/ansible-junos-stdlib/blob/master/library/junos_install_config#L158

@vnitinv
Copy link
Contributor

vnitinv commented May 30, 2014

provided a fix via
Juniper/ansible-junos-stdlib#18

@jeremyschulman
Copy link
Contributor

@vnitinv - please enhance the error message in your code patch to indicate that "set" and "override" cannot be used together. then resubmit the PR. thank you.

@jeremyschulman jeremyschulman added this to the R_1_0_0 milestone May 31, 2014
@jeremyschulman
Copy link
Contributor

this bug should be filed against Juniper/ansible-junos-stdlib since it the fix should be there.

@mamathac - please close here, reopen there, and make reference to this issue thread. thank you.

@vnitinv
Copy link
Contributor

vnitinv commented May 31, 2014

@jeremyschulman Error message will be coming as "conflicting args, cannot use 'set' with 'overwrite'" to the ansible user (similar to what is coming by PyEZ)
are you expecting something else?

@mamathac
Copy link
Author

Created Juniper/ansible-junos-stdlib#19
closing this bug.
Tracked via Juniper/ansible-junos-stdlib#19

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants