Skip to content

Syntax problem in mlag_data_compare.py #281

Description

@tcomerma

I've tried the script on exos 32.4.1.5 and it doesn't work

I'm getting a syntax error

# run script mlag_data_compare.py
###############################
MLAG peer is {0}
Traceback (most recent call last):
  File "/usr/local/cfg/mlag_data_compare.py", line 104, in <module>
    main()
  File "/usr/local/cfg/mlag_data_compare.py", line 80, in main
    print ("MLAG peer is {0}").format(peer_info['peerName'])
AttributeError: 'NoneType' object has no attribute 'format'

The problem seems to be parenthesis placement. The .format() method is being called on the result of print(), not on the string itself. Changing it to

print("MLAG peer is {0}".format(peer_info['peerName']))

Solves the issue.

Affected lines in the code:

  • Line 68: print ("MLAG peer is {0}").format(peer_info['peerName'])
  • Line 75: print ("ISC port {0}").format(isc_port)
  • Line 79: print ("{0} : {1} : {2}").format(isc_vlans['VlanName'],isc_vlans['VlanId'],isc_vlans['tag'])
  • Line 84: print ("MLAG Port {0}, ID: {1}, Rpeer : {2}").format(port['port'], port['idx'], port['remoteportstate'])
  • Line 86: print ("{0} : {1} : {2}").format(mvlan['VlanName'],mvlan['VlanId'],mvlan['tag'])

Thanks for the script !

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions