artem-sidorenko opened a new issue, #11173: URL: https://github.com/apache/cloudstack/issues/11173
### problem During a troubleshooting with virtualrouter, I noticed a lot of python2 code within a latest 4.20.1 python3 systemvm, e.g. ``` root@r-8-VM:~# update_config.py vm_dhcp_entry.json.a7403deb-a08c-4fb4-84d5-0868eda3c39d Traceback (most recent call last): File "/opt/cloud/bin/update_config.py", line 20, in <module> from merge import QueueFile File "/opt/cloud/bin/merge.py", line 26, in <module> import cs_guestnetwork if e.errno != 17: File "/opt/cloud/bin/cs_guestnetwork.py", line 32 print "[WARN] cs_guestnetwork.py :: Error occurred removing item from databag. => %s" % device_to_die ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)? root@r-8-VM:~# update_config.py vm_dhcp_entry.json.a7403deb-a08c-4fb4-84d5-0868eda3c39d Traceback (most recent call last): File "/opt/cloud/bin/update_config.py", line 24, in <module> fh.write(file + '\n') import configure File "/opt/cloud/bin/configure.py", line 648 os.chmod(dest, 0644) ^ SyntaxError: leading zeros in decimal integer literals are not permitted; use an 0o prefix for octal integers root@r-8-VM:~# vi /opt/cloud/bin/configure.py root@r-8-VM:~# update_config.py vm_dhcp_entry.json.a7403deb-a08c-4fb4-84d5-0868eda3c39d Traceback (most recent call last): File "/opt/cloud/bin/update_config.py", line 24, in <module> self.__exflock(fh) import configure File "/opt/cloud/bin/configure.py", line 652 os.makedirs(metamanifestdir, 0755) ^ SyntaxError: leading zeros in decimal integer literals are not permitted; use an 0o prefix for octal integers ``` If I compare the first file, the cs_guestnetwork.py with a git tagged 4.20.1 version [here](https://github.com/apache/cloudstack/blob/4.20.1.0/systemvm/debian/opt/cloud/bin/cs_guestnetwork.py), I see the different file content. The file version on the systemvm doesn't have the python3 parentheses fixes: ``` root@s-6-VM:~# cat /opt/cloud/bin/cs_guestnetwork.py # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. keys = ['eth1', 'eth2', 'eth3', 'eth4', 'eth5', 'eth6', 'eth7', 'eth8', 'eth9'] def merge(dbag, gn): device = gn['device'] if not gn['add'] and device in dbag: if dbag[device]: device_to_die = dbag[device][0] try: dbag[device].remove(device_to_die) except ValueError, e: print "[WARN] cs_guestnetwork.py :: Error occurred removing item from databag. => %s" % device_to_die del(dbag[device]) else: del(dbag[device]) else: dbag.setdefault(device, []).append(gn) return dbag root@s-6-VM:~# cat /etc/cloudstack-release Cloudstack Release 4.20.1 Wed May 28 06:10:04 AM UTC 2025 ``` ### versions 4.20.1 ### The steps to reproduce the bug 1. Login to any systemvm version 4.20.1 and check the python files, e.g. /opt/cloud/bin/cs_guestnetwork.py, and compare them to the git tagged revision 2. Execute things like `/usr/share/cloudstack-common/scripts/network/domr/router_proxy.sh update_config.py 169.254.11.96 vm_dhcp_entry.json.214e2917-4c5f-438b-aaa4-ce87d7f8a082` on the kvm hypervisor ... ### What to do about it? _No response_ -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@cloudstack.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org