sonic-net / sonic-buildimage

Scripts which perform an installable binary image build for SONiC
Other
723 stars 1.38k forks source link

[master] SyntaxWarning messages show up on console with config/plugins/mlnx.py #18401

Closed mlok-nokia closed 4 months ago

mlok-nokia commented 5 months ago

Description

On the latest master image, when type "sudo config" then hit tab key, the following SyntaxWarning messages show up.

dmin@sonic:~$ sudo config /usr/local/lib/python3.11/dist-packages/config/aaa.py:120: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if len(auth_protocol) is 0:
/usr/local/lib/python3.11/dist-packages/config/plugins/mlnx.py:219: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if err is not 0:
/usr/local/lib/python3.11/dist-packages/config/plugins/mlnx.py:232: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if err is not 0:
/usr/local/lib/python3.11/dist-packages/config/aaa.py:120: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if len(auth_protocol) is 0:
/usr/local/lib/python3.11/dist-packages/config/plugins/mlnx.py:219: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if err is not 0:
/usr/local/lib/python3.11/dist-packages/config/plugins/mlnx.py:232: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if err is not 0:

Steps to reproduce the issue:

  1. When first time type "sudo config" then hit tab key, the SyntaxWarning messages show up.

Describe the results you received:

Messages show screen when type "sudo config " with tab key"

dmin@sonic:~$ sudo config /usr/local/lib/python3.11/dist-packages/config/aaa.py:120: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if len(auth_protocol) is 0:
/usr/local/lib/python3.11/dist-packages/config/plugins/mlnx.py:219: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if err is not 0:
/usr/local/lib/python3.11/dist-packages/config/plugins/mlnx.py:232: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if err is not 0:
/usr/local/lib/python3.11/dist-packages/config/aaa.py:120: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if len(auth_protocol) is 0:
/usr/local/lib/python3.11/dist-packages/config/plugins/mlnx.py:219: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if err is not 0:
/usr/local/lib/python3.11/dist-packages/config/plugins/mlnx.py:232: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if err is not 0:

Describe the results you expected:

Output of show version:

Latest Master branch

(paste your output here)

Output of show techsupport:

(paste your output here or download and attach the file here )

Additional information you deem important (e.g. issue happens only occasionally):

prgeor commented 5 months ago

@qiluo-msft can you take care of this warning /usr/local/lib/python3.11/dist-packages/config/aaa.py:120: SyntaxWarning: "is" with a literal. Did you mean "=="?

prgeor commented 5 months ago

@dgsudharsan could you check the warning on mlnx.py

prgeor commented 5 months ago

@qiluo-msft would be able to work with build team to enable pylint checker

qiluo-msft commented 5 months ago

@mlok-nokia I see the command in your descritpion weird

sudo config /usr/local/lib...

Is it a mistake or on purpose?

anamehra commented 5 months ago

@qiluo-msft

/usr/local/lib...

This is coming from the log. If I press tab after "sudo config", I see these log messages being printed on the screen.

dgsudharsan commented 5 months ago

@mlok-nokia Interestingly when I do with the latest master label I don't see the issue. Are there any additional changes or settings in your image?

$ sudo config
aaa                       delete-checkpoint         ipv6                      muxcable                  rate                      synchronous_mode
acl                       dhcp_relay                kdump                     nat                       reload                    syslog
apply-patch               dhcp_server               kubernetes                ntp                       replace                   tacacs
ar                        dns                       list-checkpoints          nvgre-tunnel              rollback                  unique-ip
auto-techsupport          doroce                    load                      nvgre-tunnel-map          route                     vlan
auto-techsupport-feature  dropcounters              load_mgmt_config          override-config-table     save                      vrf
bgp                       ecn                       load_minigraph            passw-hardening           sflow                     vxlan
buffer                    fabric                    loopback                  pbh                       snmp                      warm_restart
cbf                       feature                   macsec                    pfcwd                     snmpagentaddress          watermark
chassis                   flowcnt-route             mclag                     platform                  snmptrap                  what-just-happened
checkpoint                hostname                  member                    portchannel               subinterface              yang_config_validation
clock                     interface                 mirror_session            qos                       suppress-fib-pending      ztp
console                   interface_naming_mode     mmu                       radius                    switch-hash
sudo show version

SONiC Software Version: SONiC.master.578-17d728ec7_Internal
SONiC OS Version: 12
Distribution: Debian 12.5
Kernel: 6.1.0-11-2-amd64
Build commit: 138b16f1b
Build date: Thu Mar 28 02:10:40 UTC 2024
Built by: sw-r2d2-bot@r-build-sonic-ci03-242

Platform: x86_64-mlnx_msn3420-r0
HwSKU: ACS-MSN3420
ASIC: mellanox
ASIC Count: 1
Serial Number: MT2019X13878
Model Number: MSN3420-CB2FO
Hardware Revision: A1
Uptime: 01:41:44 up 6 min,  1 user,  load average: 0.32, 0.75, 0.44
Date: Tue 02 Apr 2024 01:41:44

Docker images:
REPOSITORY                                         TAG                             IMAGE ID       SIZE
docker-orchagent                                   latest                          b12df195592e   342MB
docker-orchagent                                   master.578-17d728ec7_Internal   b12df195592e   342MB
docker-macsec                                      latest                          a0e9fe84cc53   332MB
docker-teamd                                       latest                          52fdbd6c2c4f   329MB
docker-teamd                                       master.578-17d728ec7_Internal   52fdbd6c2c4f   329MB
docker-dhcp-relay                                  latest                          b69fee2dd3c9   311MB
docker-dhcp-server                                 latest                          41ed99e9b23b   325MB
docker-database                                    latest                          669e2e460da2   310MB
docker-database                                    master.578-17d728ec7_Internal   669e2e460da2   310MB
docker-mux                                         latest                          f75b55abc93a   354MB
docker-mux                                         master.578-17d728ec7_Internal   f75b55abc93a   354MB
docker-router-advertiser                           latest                          d5661cf305ae   302MB
docker-router-advertiser                           master.578-17d728ec7_Internal   d5661cf305ae   302MB
docker-platform-monitor                            latest                          4ff5b92091d5   590MB
docker-platform-monitor                            master.578-17d728ec7_Internal   4ff5b92091d5   590MB
docker-syncd-mlnx                                  latest                          6ffef58a73b4   771MB
docker-syncd-mlnx                                  master.578-17d728ec7_Internal   6ffef58a73b4   771MB
docker-fpm-frr                                     latest                          b04712aeac9f   362MB
docker-fpm-frr                                     master.578-17d728ec7_Internal   b04712aeac9f   362MB
docker-eventd                                      latest                          e6921e665008   302MB
docker-eventd                                      master.578-17d728ec7_Internal   e6921e665008   302MB
docker-nat                                         latest                          35f24fde228d   334MB
docker-nat                                         master.578-17d728ec7_Internal   35f24fde228d   334MB
docker-sflow                                       latest                          f526325f8332   332MB
docker-sflow                                       master.578-17d728ec7_Internal   f526325f8332   332MB
docker-snmp                                        latest                          e939dcc3b490   342MB
docker-snmp                                        master.578-17d728ec7_Internal   e939dcc3b490   342MB
docker-lldp                                        latest                          4c8c3fd0d6bc   345MB
docker-lldp                                        master.578-17d728ec7_Internal   4c8c3fd0d6bc   345MB
docker-sonic-gnmi                                  latest                          c7586e4fd458   392MB
docker-sonic-gnmi                                  master.578-17d728ec7_Internal   c7586e4fd458   392MB
docker-sonic-mgmt-framework                        latest                          479be4c555b8   387MB
docker-sonic-mgmt-framework                        master.578-17d728ec7_Internal   479be4c555b8   387MB
mlok-nokia commented 4 months ago

Issue no longer shown up