Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

Use "/usr/bin/env python3" consistently for Python3 scripts #788

Open
sbonds opened this issue Mar 31, 2021 · 2 comments
Open

Use "/usr/bin/env python3" consistently for Python3 scripts #788

sbonds opened this issue Mar 31, 2021 · 2 comments

Comments

@sbonds
Copy link

sbonds commented Mar 31, 2021

One of the workarounds for #764 is to set up a /usr/bin/python link so that #!/usr/bin/env python can find something to use as its interpreter.

Within the scripts, the use of #!/usr/bin/env is inconsistent. In some scripts we have this old config which requires the set-alternatives workaround: #!/usr/bin/env python. This is present even in the "ported to Python 3" directory. For example:

In other places, there's the more explicit and will-work-on-RHEL8-by-default #!/usr/bin/env python3:

It seems like since #!/usr/bin/env python3 is already in use in some scripts, it would make sense to configure this as the default for all of the scripts in the 3.x directory. This appears to already be the case for the set of scripts in Providers/nxOMSAutomationWorker/automationworker/3.x with the odd exceptions of worker/__init__.py and worker/importHelper.py

@jineshcodes
Copy link
Contributor

This was fixed as a part of this PR: #789

I think we can go ahed and close this.

@sbonds
Copy link
Author

sbonds commented May 13, 2021

Looks like some might be missed. Running this against the repo:

find . -name "*.py"  | grep 3.x | xargs head -1 | grep --before-context=1 -E 'env python$'

Shows some default python in use:

==> ./Providers/Scripts/3.x/Scripts/Tests/run_test_OMS_nxProviders.py <==
#!/usr/bin/env python
--
==> ./Providers/Scripts/3.x/Scripts/Tests/test_OMS_nxProviders.py <==
#!/usr/bin/env python
--
==> ./Providers/Scripts/3.x/Scripts/Tests/test_nxOMSPluginProvider.py <==
#!/usr/bin/env python
--
==> ./Providers/Scripts/3.x/Scripts/nxComputer.py <==
# !/usr/bin/env python
--
==> ./Providers/Scripts/3.x/Scripts/nxDNSServerAddress.py <==
#!/usr/bin/env python
--
==> ./Providers/Scripts/3.x/Scripts/nxFirewall.py <==
#!/bin/env python
--
==> ./Providers/Scripts/3.x/Scripts/nxIPAddress.py <==
#!/usr/bin/env python
--
==> ./Providers/Scripts/3.x/Scripts/nxMySqlDatabase.py <==
#!/usr/bin/env python
--
==> ./Providers/Scripts/3.x/Scripts/nxMySqlGrant.py <==
#!/usr/bin/env python
--
==> ./Providers/Scripts/3.x/Scripts/nxMySqlUser.py <==
#!/usr/bin/env python
--
==> ./Providers/Scripts/3.x/Scripts/nxNop.py <==
#!/usr/bin/env python
--
==> ./Providers/Scripts/3.x/Scripts/nxOMSAgentNPMConfig.py <==
#!/usr/bin/env python
--
==> ./Providers/Scripts/3.x/Scripts/nxOMSAuditdPlugin.py <==
#!/usr/bin/env python
--
==> ./Providers/Scripts/3.x/Scripts/nxOMSContainers.py <==
#!/usr/bin/env python
--
==> ./Providers/Scripts/3.x/Scripts/nxOMSCustomLog.py <==
#!/usr/bin/env python
--
==> ./Providers/Scripts/3.x/Scripts/nxOMSPerfCounter.py <==
#!/usr/bin/env python
--
==> ./Providers/Scripts/3.x/Scripts/nxOMSSudoCustomLog.py <==
#!/usr/bin/env python
--
==> ./Providers/Scripts/3.x/Scripts/nxOMSSyslog.py <==
#!/usr/bin/env python
--
==> ./Providers/nxOMSAutomationWorker/automationworker/3.x/worker/__init__.py <==
#!/usr/bin/env python
--
==> ./Providers/nxOMSAutomationWorker/automationworker/3.x/worker/importHelper.py <==
#!/usr/bin/env python

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants