Skip to content

Conversation

@zRains
Copy link
Contributor

@zRains zRains commented Jul 30, 2024

What changes were proposed in this pull request?

Modify the interpreter for all Python files to python3.

How was this patch tested?

N/A

@zRains zRains marked this pull request as draft July 31, 2024 07:58
@zRains zRains marked this pull request as ready for review August 1, 2024 02:26
@zRains
Copy link
Contributor Author

zRains commented Aug 1, 2024

cc @JiaLiangC

@JiaLiangC
Copy link
Contributor

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

@virajjasani
Copy link
Contributor

virajjasani commented Aug 1, 2024

Indeed this is huge PR. Thanks for working on this @zRains.

Curious what would be the testing approach here? We want to make sure that we are not breaking anything.

@zRains
Copy link
Contributor Author

zRains commented Aug 2, 2024

@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.

@virajjasani
Copy link
Contributor

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

@JiaLiangC
Copy link
Contributor

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.

@JiaLiangC JiaLiangC merged commit 3271fa9 into apache:trunk Aug 5, 2024
@zRains zRains deleted the fix-py-script branch August 11, 2024 16:21
@quanzhouwang
Copy link

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
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 "", line 47, in
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)

@virajjasani
Copy link
Contributor

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

@JiaLiangC
Copy link
Contributor

@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

@quanzhouwang
Copy link

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

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