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

jnpr.junos.utils.sw.SW.install does nothing for M10i with dual-RE (returns None) #216

Closed
mamathac opened this issue May 20, 2014 · 7 comments
Assignees
Milestone

Comments

@mamathac
Copy link

Model - SRX5600, m10i, dual RE.

Playbook code:

  • name: Junos OS
    hosts: all
    connection: local
    gather_facts: no
    vars:
    restart_wait_time: 3600
    reboot: 'yes'

    tasks:

    • include: task_check_nc
    • name: install Junos OS package
      junos_install_os:
      host={{ inventory_hostname }}
      user='XXXXX'
      passwd='XXXX'
      version=13.2R4.6
      package=/usr/local/junos/images/jinstall-13.2R4.6-domestic-signed.tgz
      logfile=/usr/local/junos/log/software.log
      register: sw
      regress@vm-nomadic-ubuntu:~/ansible_junos/mydir_ansible/pb$ ansible-playbook softwr --limit m10i

PLAY [Junos OS] ***************************************************************

TASK: [checking NETCONF] ******************************************************
ok: [popeye]

TASK: [install Junos OS package] **********************************************
failed: [popeye] => {"failed": true, "parsed": false}
invalid output was: Traceback (most recent call last):
File "/home/regress/.ansible/tmp/ansible-tmp-1400567208.68-138855836321347/junos_install_os", line 1404, in
main()
File "/home/regress/.ansible/tmp/ansible-tmp-1400567208.68-138855836321347/junos_install_os", line 223, in main
results = junos_install_os(module, dev)
File "/home/regress/.ansible/tmp/ansible-tmp-1400567208.68-138855836321347/junos_install_os", line 175, in junos_install_os
results['msg'] = "Unable to install the software: " + ok
TypeError: cannot concatenate 'str' and 'NoneType' objects

FATAL: all hosts have already failed -- aborting

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

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

2014-05-20 11:56:54,210:popeye:Starting the software upgrade process: /usr/local/junos/images/jinstall-13.2R4.6-domestic-signed.tgz
2014-05-20 11:56:54,211:popeye:computing local checksum on: /usr/local/junos/images/jinstall-13.2R4.6-domestic-signed.tgz
2014-05-20 11:56:55,945:popeye:cleaning filesystem ...
2014-05-20 11:57:09,506:paramiko.transport:starting thread (client mode): 0x955ad2cL
2014-05-20 11:57:09,572:paramiko.transport:Connected (version 2.0, client OpenSSH_6.6.1)
2014-05-20 11:57:09,579:paramiko.transport:kex algos:[u'curve25519-sha256@libssh.org', u'ecdh-sha2-nistp256', u'ecdh-sha2-nistp384', u'ecdh-

sha2-nistp521', u'diffie-hellman-group-exchange-sha256', u'diffie-hellman-group-exchange-sha1', u'diffie-hellman-group14-sha1', u'diffie-

hellman-group1-sha1'] server key:[u'ssh-rsa', u'ssh-dss', u'ecdsa-sha2-nistp256', u'ssh-ed25519'] client encrypt:[u'aes128-ctr', u'aes192-

ctr', u'aes256-ctr', u'arcfour256', u'arcfour128', u'aes128-gcm@openssh.com', u'aes256-gcm@openssh.com', u'chacha20-poly1305@openssh.com',

u'aes128-cbc', u'3des-cbc', u'blowfish-cbc', u'cast128-cbc', u'aes192-cbc', u'aes256-cbc', u'arcfour', u'rijndael-cbc@lysator.liu.se'] server

encrypt:[u'aes128-ctr', u'aes192-ctr', u'aes256-ctr', u'arcfour256', u'arcfour128', u'aes128-gcm@openssh.com', u'aes256-gcm@openssh.com',

u'chacha20-poly1305@openssh.com', u'aes128-cbc', u'3des-cbc', u'blowfish-cbc', u'cast128-cbc', u'aes192-cbc', u'aes256-cbc', u'arcfour',

u'rijndael-cbc@lysator.liu.se'] client mac:[u'hmac-md5-etm@openssh.com', u'hmac-sha1-etm@openssh.com', u'umac-64-etm@openssh.com', u'umac-

128-etm@openssh.com', u'hmac-sha2-256-etm@openssh.com', u'hmac-sha2-512-etm@openssh.com', u'hmac-ripemd160-etm@openssh.com', u'hmac-sha1-96-

etm@openssh.com', u'hmac-md5-96-etm@openssh.com', u'hmac-md5', u'hmac-sha1', u'umac-64@openssh.com', u'umac-128@openssh.com', u'hmac-sha2-

256', u'hmac-sha2-256-96', u'hmac-sha2-512', u'hmac-sha2-512-96', u'hmac-ripemd160', u'hmac-ripemd160@openssh.com', u'hmac-sha1-96', u'hmac-

md5-96'] server mac:[u'hmac-md5-etm@openssh.com', u'hmac-sha1-etm@openssh.com', u'umac-64-etm@openssh.com', u'umac-128-etm@openssh.com',

u'hmac-sha2-256-etm@openssh.com', u'hmac-sha2-512-etm@openssh.com', u'hmac-ripemd160-etm@openssh.com', u'hmac-sha1-96-etm@openssh.com',

u'hmac-md5-96-etm@openssh.com', u'hmac-md5', u'hmac-sha1', u'umac-64@openssh.com', u'umac-128@openssh.com', u'hmac-sha2-256', u'hmac-sha2-

256-96', u'hmac-sha2-512', u'hmac-sha2-512-96', u'hmac-ripemd160', u'hmac-ripemd160@openssh.com', u'hmac-sha1-96', u'hmac-md5-96'] client

compress:[u'none', u'zlib@openssh.com'] server compress:[u'none', u'zlib@openssh.com'] client lang:[u''] server lang:[u''] kex follows?False
2014-05-20 11:57:09,579:paramiko.transport:Ciphers agreed: local=aes128-ctr, remote=aes128-ctr
2014-05-20 11:57:09,579:paramiko.transport:using kex diffie-hellman-group1-sha1; server key type ssh-rsa; cipher: local aes128-ctr, remote

aes128-ctr; mac: local hmac-sha1, remote hmac-sha1; compression: local none, remote none
2014-05-20 11:57:09,702:paramiko.transport:Switch to new keys ...
2014-05-20 11:57:09,708:paramiko.transport:Adding ssh-rsa host key for popeye: a7aef6fe1c4778c475952e65bc2460a2
2014-05-20 11:57:09,709:paramiko.transport:Trying discovered key 97fdf2252faec2370d209d7cc02d2095 in /home/regress/.ssh/id_rsa
2014-05-20 11:57:09,802:paramiko.transport:userauth is OK
2014-05-20 11:57:10,172:paramiko.transport:Authentication (publickey) failed.
2014-05-20 11:57:10,188:paramiko.transport:userauth is OK
2014-05-20 11:57:10,200:paramiko.transport:Authentication (password) successful!
2014-05-20 11:57:10,204:paramiko.transport:[chan 1] Max packet in: 34816 bytes
2014-05-20 11:57:10,205:paramiko.transport:[chan 1] Max packet out: 32768 bytes
2014-05-20 11:57:10,205:paramiko.transport:Secsh channel 1 opened.
2014-05-20 11:57:10,211:paramiko.transport:[chan 1] Sesch channel 1 request ok
2014-05-20 11:57:28,063:popeye:jinstall-13.2R4.6-domestic-signed.tgz: 66355200 / 663438283 (10%)
2014-05-20 11:57:44,638:popeye:jinstall-13.2R4.6-domestic-signed.tgz: 132694016 / 663438283 (20%)
2014-05-20 11:58:01,160:popeye:jinstall-13.2R4.6-domestic-signed.tgz: 199032832 / 663438283 (30%)
2014-05-20 11:58:17,777:popeye:jinstall-13.2R4.6-domestic-signed.tgz: 265388032 / 663438283 (40%)
2014-05-20 11:58:34,377:popeye:jinstall-13.2R4.6-domestic-signed.tgz: 331726848 / 663438283 (50%)
2014-05-20 11:58:50,890:popeye:jinstall-13.2R4.6-domestic-signed.tgz: 398065664 / 663438283 (60%)
2014-05-20 11:59:07,475:popeye:jinstall-13.2R4.6-domestic-signed.tgz: 464420864 / 663438283 (70%)
2014-05-20 11:59:23,950:popeye:jinstall-13.2R4.6-domestic-signed.tgz: 530759680 / 663438283 (80%)
2014-05-20 11:59:24,964:paramiko.transport:Rekeying (hit 38295 packets, 536880492 bytes sent)
2014-05-20 11:59:24,983:paramiko.transport:kex algos:[u'curve25519-sha256@libssh.org', u'ecdh-sha2-nistp256', u'ecdh-sha2-nistp384', u'ecdh-

sha2-nistp521', u'diffie-hellman-group-exchange-sha256', u'diffie-hellman-group-exchange-sha1', u'diffie-hellman-group14-sha1', u'diffie-

hellman-group1-sha1'] server key:[u'ssh-rsa', u'ssh-dss', u'ecdsa-sha2-nistp256', u'ssh-ed25519'] client encrypt:[u'aes128-ctr', u'aes192-

ctr', u'aes256-ctr', u'arcfour256', u'arcfour128', u'aes128-gcm@openssh.com', u'aes256-gcm@openssh.com', u'chacha20-poly1305@openssh.com',

u'aes128-cbc', u'3des-cbc', u'blowfish-cbc', u'cast128-cbc', u'aes192-cbc', u'aes256-cbc', u'arcfour', u'rijndael-cbc@lysator.liu.se'] server

encrypt:[u'aes128-ctr', u'aes192-ctr', u'aes256-ctr', u'arcfour256', u'arcfour128', u'aes128-gcm@openssh.com', u'aes256-gcm@openssh.com',

u'chacha20-poly1305@openssh.com', u'aes128-cbc', u'3des-cbc', u'blowfish-cbc', u'cast128-cbc', u'aes192-cbc', u'aes256-cbc', u'arcfour',

u'rijndael-cbc@lysator.liu.se'] client mac:[u'hmac-md5-etm@openssh.com', u'hmac-sha1-etm@openssh.com', u'umac-64-etm@openssh.com', u'umac-

128-etm@openssh.com', u'hmac-sha2-256-etm@openssh.com', u'hmac-sha2-512-etm@openssh.com', u'hmac-ripemd160-etm@openssh.com', u'hmac-sha1-96-

etm@openssh.com', u'hmac-md5-96-etm@openssh.com', u'hmac-md5', u'hmac-sha1', u'umac-64@openssh.com', u'umac-128@openssh.com', u'hmac-sha2-

256', u'hmac-sha2-256-96', u'hmac-sha2-512', u'hmac-sha2-512-96', u'hmac-ripemd160', u'hmac-ripemd160@openssh.com', u'hmac-sha1-96', u'hmac-

md5-96'] server mac:[u'hmac-md5-etm@openssh.com', u'hmac-sha1-etm@openssh.com', u'umac-64-etm@openssh.com', u'umac-128-etm@openssh.com',

u'hmac-sha2-256-etm@openssh.com', u'hmac-sha2-512-etm@openssh.com', u'hmac-ripemd160-etm@openssh.com', u'hmac-sha1-96-etm@openssh.com',

u'hmac-md5-96-etm@openssh.com', u'hmac-md5', u'hmac-sha1', u'umac-64@openssh.com', u'umac-128@openssh.com', u'hmac-sha2-256', u'hmac-sha2-

256-96', u'hmac-sha2-512', u'hmac-sha2-512-96', u'hmac-ripemd160', u'hmac-ripemd160@openssh.com', u'hmac-sha1-96', u'hmac-md5-96'] client

compress:[u'none', u'zlib@openssh.com'] server compress:[u'none', u'zlib@openssh.com'] client lang:[u''] server lang:[u''] kex follows?False
2014-05-20 11:59:24,983:paramiko.transport:Ciphers agreed: local=aes128-ctr, remote=aes128-ctr
2014-05-20 11:59:24,983:paramiko.transport:using kex diffie-hellman-group1-sha1; server key type ssh-rsa; cipher: local aes128-ctr, remote

aes128-ctr; mac: local hmac-sha1, remote hmac-sha1; compression: local none, remote none
2014-05-20 11:59:25,102:paramiko.transport:Switch to new keys ...
2014-05-20 11:59:40,564:popeye:jinstall-13.2R4.6-domestic-signed.tgz: 597098496 / 663438283 (90%)
2014-05-20 11:59:57,109:popeye:jinstall-13.2R4.6-domestic-signed.tgz: 663438283 / 663438283 (100%)
2014-05-20 11:59:57,323:paramiko.transport:[chan 1] EOF sent (1)
2014-05-20 11:59:57,328:paramiko.transport:EOF in transport thread
2014-05-20 11:59:57,332:popeye:computing remote checksum on: /var/tmp/jinstall-13.2R4.6-domestic-signed.tgz
2014-05-20 12:00:13,835:popeye:checksum check passed.

@mamathac mamathac changed the title <junos_install_os> cannot concatenate 'str' and 'NoneType' objects for router with dual RE <junos_install_os> Error- "cannot concatenate 'str' and 'NoneType' objects" for router with dual RE May 20, 2014
@vnitinv vnitinv self-assigned this May 20, 2014
@jeremyschulman
Copy link
Contributor

Posting the actual issue here since it was hard to find:

File "/home/regress/.ansible/tmp/ansible-tmp-1400567208.68-138855836321347/junos_install_os", line 1404, in
main()
File "/home/regress/.ansible/tmp/ansible-tmp-1400567208.68-138855836321347/junos_install_os", line 223, in main
results = junos_install_os(module, dev)
File "/home/regress/.ansible/tmp/ansible-tmp-1400567208.68-138855836321347/junos_install_os", line 175, in junos_install_os
results['msg'] = "Unable to install the software: " + ok
TypeError: cannot concatenate 'str' and 'NoneType' objects

@jeremyschulman
Copy link
Contributor

this issue is actually scoped to the ansible modules. I am closing this issue, but will open one on the ansible repo and reference this.

@jeremyschulman
Copy link
Contributor

the issue in this case appears to be that the M10i has dual RE and the jnpr.junos.utils.sw module is not handling this case correctly. Basically the sw.install doesn't do anything and returns NoneType.

@jeremyschulman
Copy link
Contributor

testing a fix, I've manually copied the code to the device and then performed a test as follows:

>>> sw.install(no_copy=True, remote_path='/var/home', package='jinstall-13.2R4.6-domestic-signed.tgz', progress=progress)
popeye.englab.juniper.net: installing software on RE0 ... please be patient ...
popeye.englab.juniper.net: installing software on RE1 ... please be patient ...
True

@jeremyschulman
Copy link
Contributor

>>> sw.reboot(0)
'Shutdown NOW!\nReboot consistency check bypassed - jinstall 13.2R4.6 will complete installation upon reboot\n[pid 10318]'

@jeremyschulman jeremyschulman changed the title <junos_install_os> Error- "cannot concatenate 'str' and 'NoneType' objects" for router with dual RE jnpr.junos.utils.sw.SW.install does nothing for M10i with dual-RE (returns None) May 23, 2014
@jeremyschulman
Copy link
Contributor

process completed A-OK:

>>> pp(dev.facts)
{'2RE': True,
 'HOME': '/root',
 'RE0': {'last_reboot_reason': 'Router rebooted after a normal shutdown.',
         'mastership_state': 'master',
         'model': 'RE-850',
         'status': 'OK',
         'up_time': '24 minutes, 21 seconds'},
 'RE1': {'last_reboot_reason': 'Router rebooted after a normal shutdown.',
         'mastership_state': 'backup',
         'model': 'RE-5.0',
         'status': 'OK',
         'up_time': '16 minutes, 8 seconds'},
 'domain': 'englab.juniper.net',
 'fqdn': 'popeye.englab.juniper.net',
 'hostname': 'popeye',
 'ifd_style': 'CLASSIC',
 'master': 'RE0',
 'model': 'M10I',
 'personality': 'M',
 'serialnumber': 'A2090',
 'switch_style': 'NONE',
 'vc_capable': False,
 'version': '13.2R4.6',
 'version_RE0': '13.2R4.6',
 'version_RE1': '13.2R4.6',
 'version_info': junos.version_info(major=(13, 2), type=R, minor=4, build=6)}

@jeremyschulman
Copy link
Contributor

fixed, merged to master.

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

3 participants