You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ambari.apache.org by "zRains (via GitHub)" <gi...@apache.org> on 2024/07/30 08:06:30 UTC

[PR] AMBARI-26100: Fix all python script file to python3 [ambari]

zRains opened a new pull request, #3799:
URL: https://github.com/apache/ambari/pull/3799

   ## What changes were proposed in this pull request?
   
   Modify the interpreter for all Python files to python3.
   
   ## How was this patch tested?
   
   N/A


-- 
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: dev-unsubscribe@ambari.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ambari.apache.org
For additional commands, e-mail: dev-help@ambari.apache.org


Re: [PR] AMBARI-26100: Fix all python script file to python3 [ambari]

Posted by "JiaLiangC (via GitHub)" <gi...@apache.org>.
JiaLiangC commented on code in PR #3799:
URL: https://github.com/apache/ambari/pull/3799#discussion_r1699313597


##########
ambari-server/src/main/python/os_check_type.py:
##########
@@ -1,5 +1,4 @@
 #!/usr/bin/ambari-python-wrap

Review Comment:
   - #!/usr/bin/ambari-python-wrap
   + #!/usr/bin/env ambari-python-wrap
   
   Consider using the `env` approach for the shebang line.
   
   The current shebang assumes a fixed path for `ambari-python-wrap`. Using `env` instead offers several advantages:
   
   1. Improved portability across different systems and environments.
   2. Better flexibility in finding the interpreter through the system's PATH.
   3. Respects user-specific environment settings.
   4. Aligns with widely accepted best practices for script writing.
   
   This change maintains functionality while enhancing the script's adaptability to various installation setups. It's particularly beneficial if the script might be used across different environments or if `ambari-python-wrap` isn't always located in `/usr/bin/`.
   
   While there's a negligible performance trade-off, the benefits in flexibility and portability generally outweigh this minor consideration.
   
   Please consider making this change to improve the overall robustness of the script.
   



-- 
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: dev-unsubscribe@ambari.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ambari.apache.org
For additional commands, e-mail: dev-help@ambari.apache.org


Re: [PR] AMBARI-26100: Fix all python script file to python3 [ambari]

Posted by "JiaLiangC (via GitHub)" <gi...@apache.org>.
JiaLiangC commented on PR #3799:
URL: https://github.com/apache/ambari/pull/3799#issuecomment-2266332645

   > Sounds good. Let me take a look today. @JiaLiangC you can also take a look in the meantime.
   The modifications look fine. All the modified code has Python unit tests, and everything is covered. I think it's OK.
   


-- 
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: dev-unsubscribe@ambari.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ambari.apache.org
For additional commands, e-mail: dev-help@ambari.apache.org


Re: [PR] AMBARI-26100: Fix all python script file to python3 [ambari]

Posted by "zRains (via GitHub)" <gi...@apache.org>.
zRains commented on PR #3799:
URL: https://github.com/apache/ambari/pull/3799#issuecomment-2261828425

   cc @JiaLiangC


-- 
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: dev-unsubscribe@ambari.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ambari.apache.org
For additional commands, e-mail: dev-help@ambari.apache.org


Re: [PR] AMBARI-26100: Fix all python script file to python3 [ambari]

Posted by "JiaLiangC (via GitHub)" <gi...@apache.org>.
JiaLiangC commented on PR #3799:
URL: https://github.com/apache/ambari/pull/3799#issuecomment-2261948862

   @virajjasani This is quite a substantial PR aimed at unifying the Python interpreter headers. Do you have any thoughts or insights on this?


-- 
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: dev-unsubscribe@ambari.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ambari.apache.org
For additional commands, e-mail: dev-help@ambari.apache.org


Re: [PR] AMBARI-26100: Fix all python script file to python3 [ambari]

Posted by "zRains (via GitHub)" <gi...@apache.org>.
zRains commented on PR #3799:
URL: https://github.com/apache/ambari/pull/3799#issuecomment-2264415260

   @virajjasani The added interpreter declarations may not be used and generally have little side effect. Since Python 3 is already supported in #3751 we can safely replace the declarations. All changes have passed the [tests](https://ci-hadoop.apache.org/blue/organizations/jenkins/Ambari%2FAmbari-PreCommit-GitHub-PR/detail/PR-3799/8/pipeline).


-- 
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: dev-unsubscribe@ambari.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ambari.apache.org
For additional commands, e-mail: dev-help@ambari.apache.org


Re: [PR] AMBARI-26100: Fix all python script file to python3 [ambari]

Posted by "quanzhouwang (via GitHub)" <gi...@apache.org>.
quanzhouwang commented on PR #3799:
URL: https://github.com/apache/ambari/pull/3799#issuecomment-2337760095

   hi, turned on ranger and kerberos and found that some python scripts reported errors and failed because python3 was not supported yet. 
   Traceback (most recent call last):
     File "/var/lib/ambari-agent/cache/stacks/BIGTOP/3.2.0/services/KERBEROS/package/scripts/kerberos_client.py", line 92, in <module>
       KerberosClient().execute()
     File "/usr/lib/ambari-agent/lib/resource_management/libraries/script/script.py", line 354, in execute
       method(env)
     File "/var/lib/ambari-agent/cache/stacks/BIGTOP/3.2.0/services/KERBEROS/package/scripts/kerberos_client.py", line 36, in install
       self.configure(env)
     File "/var/lib/ambari-agent/cache/stacks/BIGTOP/3.2.0/services/KERBEROS/package/scripts/kerberos_client.py", line 42, in configure
       write_krb5_conf(params)
     File "/usr/lib/ambari-agent/lib/ambari_commons/kerberos/kerberos_common.py", line 95, in write_krb5_conf
       File(params.krb5_conf_path,
     File "/usr/lib/ambari-agent/lib/resource_management/core/base.py", line 164, in __init__
       self.env.run()
     File "/usr/lib/ambari-agent/lib/resource_management/core/environment.py", line 163, in run
       self.run_action(resource, action)
     File "/usr/lib/ambari-agent/lib/resource_management/core/environment.py", line 127, in run_action
       provider_action()
     File "/usr/lib/ambari-agent/lib/resource_management/core/providers/system.py", line 123, in action_create
       content = self._get_content()
     File "/usr/lib/ambari-agent/lib/resource_management/core/providers/system.py", line 166, in _get_content
       return content()
     File "/usr/lib/ambari-agent/lib/resource_management/core/source.py", line 51, in __call__
       return self.get_content()
     File "/usr/lib/ambari-agent/lib/resource_management/core/source.py", line 143, in get_content
       rendered = self.template.render(self.context)
     File "/usr/lib/ambari-agent/lib/ambari_jinja2/environment.py", line 893, in render
       return self.environment.handle_exception(exc_info, True)
     File "/usr/lib/ambari-agent/lib/ambari_jinja2/environment.py", line 669, in handle_exception
       raise exc_type(exc_value).with_traceback(tb)
     File "<template>", line 47, in <module>
   TypeError: '>' not supported between instances of 'str' and 'int'
   
   I found that some scripts only declare python3 at the beginning, but the syntax and other errors in them seem to have not been corrected. 
   such as
   ambari-common/src/main/python/resource_management/libraries/functions/ranger_functions_v2.py
   
    136 :admin_password = unicode(admin_password)
   


-- 
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: dev-unsubscribe@ambari.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ambari.apache.org
For additional commands, e-mail: dev-help@ambari.apache.org


Re: [PR] AMBARI-26100: Fix all python script file to python3 [ambari]

Posted by "virajjasani (via GitHub)" <gi...@apache.org>.
virajjasani commented on PR #3799:
URL: https://github.com/apache/ambari/pull/3799#issuecomment-2265581604

   Sounds good. Let me take a look today. @JiaLiangC you can also take a look in the meantime.


-- 
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: dev-unsubscribe@ambari.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ambari.apache.org
For additional commands, e-mail: dev-help@ambari.apache.org


Re: [PR] AMBARI-26100: Fix all python script file to python3 [ambari]

Posted by "virajjasani (via GitHub)" <gi...@apache.org>.
virajjasani commented on PR #3799:
URL: https://github.com/apache/ambari/pull/3799#issuecomment-2338575004

   @quanzhouwang thank you for reporting these errors. Are you interested in creating separate Jira and also PR to fix them?


-- 
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: dev-unsubscribe@ambari.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ambari.apache.org
For additional commands, e-mail: dev-help@ambari.apache.org


Re: [PR] AMBARI-26100: Fix all python script file to python3 [ambari]

Posted by "zRains (via GitHub)" <gi...@apache.org>.
zRains commented on code in PR #3799:
URL: https://github.com/apache/ambari/pull/3799#discussion_r1699323543


##########
ambari-server/src/main/python/os_check_type.py:
##########
@@ -1,5 +1,4 @@
 #!/usr/bin/ambari-python-wrap

Review Comment:
   got it.



-- 
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: dev-unsubscribe@ambari.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ambari.apache.org
For additional commands, e-mail: dev-help@ambari.apache.org


Re: [PR] AMBARI-26100: Fix all python script file to python3 [ambari]

Posted by "JiaLiangC (via GitHub)" <gi...@apache.org>.
JiaLiangC commented on PR #3799:
URL: https://github.com/apache/ambari/pull/3799#issuecomment-2339395380

   @virajjasani @quanzhouwang Hello, the related PR for enabling Kerberos has been submitted but not yet merged. You can refer to this PR to fix the issue you are encountering: https://github.com/apache/ambari/pull/3793/files#diff-aed3ca5cc011c2ddb3a5950cd8b6cf4ff3486275ed6d1d7a9af1a39beb9f914cL47


-- 
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: dev-unsubscribe@ambari.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ambari.apache.org
For additional commands, e-mail: dev-help@ambari.apache.org


Re: [PR] AMBARI-26100: Fix all python script file to python3 [ambari]

Posted by "virajjasani (via GitHub)" <gi...@apache.org>.
virajjasani commented on PR #3799:
URL: https://github.com/apache/ambari/pull/3799#issuecomment-2261999756

   Indeed this is huge PR. Thanks for working on this @zRains.
   
   What would be the testing approach here? We want to make sure that we are not breaking anything.


-- 
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: dev-unsubscribe@ambari.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ambari.apache.org
For additional commands, e-mail: dev-help@ambari.apache.org


Re: [PR] AMBARI-26100: Fix all python script file to python3 [ambari]

Posted by "quanzhouwang (via GitHub)" <gi...@apache.org>.
quanzhouwang commented on PR #3799:
URL: https://github.com/apache/ambari/pull/3799#issuecomment-2342855380

   @JiaLiangC @virajjasani thank , let’s try repackaging and installing to see if this problem exists,


-- 
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: dev-unsubscribe@ambari.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ambari.apache.org
For additional commands, e-mail: dev-help@ambari.apache.org


Re: [PR] AMBARI-26100: Fix all python script file to python3 [ambari]

Posted by "JiaLiangC (via GitHub)" <gi...@apache.org>.
JiaLiangC merged PR #3799:
URL: https://github.com/apache/ambari/pull/3799


-- 
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: dev-unsubscribe@ambari.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ambari.apache.org
For additional commands, e-mail: dev-help@ambari.apache.org