Skip to content

Conversation

bernhardkaindl
Copy link
Collaborator

@bernhardkaindl bernhardkaindl commented Jul 13, 2024

Hi @psafont and @ashwin9390,

Sinlge-line fix for Python3 support in https://github.com/xenserver-next/xen-api/blob/feature/py3/scripts/generate-iscsi-iqn

- if __name__ == "__main__": print f(sys.argv[1])
+ if __name__ == "__main__": print(f(sys.argv[1]))

TL;DR

By visual inspection of the shell script
https://github.com/xenserver-next/xen-api/blob/feature/py3/scripts/generate-iscsi-iqn
(that runs an inline python script), I saw a remaining print statement, that needs to be a function:

BTW: The inline Python script is used to reverse a domain name for the shell script:

arg: www.name.com
ret: com.name.www 

PS: I guess that's something special for iSCSI (not related: DNS has the same of reverse DNS).

PPS: That could likely be done in the shell itself, but since that's in a large loop (I guess) it shouldn't be a performance issue to call PYthon for reversing the domain name.

I tested the resulting shell script to successfully reverse the domain name with Python3 too.

Link to the commit: scripts/generate-iscsi-iqn: Fix inline Python to work in Py3

@bernhardkaindl bernhardkaindl changed the title scripts/generate-iscsi-iqn: Fix inline Python to work with Py3 scripts/generate-iscsi-iqn: Update the inline Python script for Py3 Jul 16, 2024
@bernhardkaindl bernhardkaindl merged commit 283244c into xapi-project:feature/py3 Jul 16, 2024
@bernhardkaindl bernhardkaindl deleted the py3-scripts/generate-iscsi-iqn branch July 17, 2024 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants