Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ambari-server/conf/unix/ambari-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ AMBARI_JVM_ARGS="--add-opens java.base/java.lang=ALL-UNNAMED "
AMBARI_JVM_ARGS+="--add-opens java.base/java.util.regex=ALL-UNNAMED "
AMBARI_JVM_ARGS+="--add-opens java.base/java.util=ALL-UNNAMED "
AMBARI_JVM_ARGS+="--add-opens java.base/java.lang.reflect=ALL-UNNAMED "
AMBARI_JVM_ARGS+="--add-opens java.naming/com.sun.jndi.ldap=ALL-UNNAMED "
AMBARI_JVM_ARGS+="-Xms512m -Xmx2048m "
AMBARI_JVM_ARGS+="-Djava.security.auth.login.config=$ROOT/etc/ambari-server/conf/krb5JAASLogin.conf "
AMBARI_JVM_ARGS+="-Djava.security.krb5.conf=/etc/krb5.conf "
Expand Down
2 changes: 1 addition & 1 deletion ambari-server/src/main/python/ambari_server/serverUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ def perform_changes_via_rest_api(
request.add_header("Authorization", f"Basic {admin_auth}")
request.add_header("X-Requested-By", "ambari")
if request_data is not None:
request.data = json.dumps(request_data)
request.data = json.dumps(request_data).encode("utf-8")
request.get_method = lambda: get_method

with closing(
Expand Down
4 changes: 2 additions & 2 deletions ambari-server/src/main/python/ambari_server/setupSecurity.py
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ def sync_ldap(options):
if get_verbose():
sys.stdout.write("\nCalling API " + url + " : " + str(bodies) + "\n")

request.data = json.dumps(bodies)
request.data = json.dumps(bodies).encode("utf-8")
request.get_method = lambda: "POST"

try:
Expand All @@ -646,7 +646,7 @@ def sync_ldap(options):
request.add_header("Authorization", f"Basic {admin_auth}")
request.add_header("X-Requested-By", "ambari")
body = [{"LDAP": {"synced_groups": "*", "synced_users": "*"}}]
request.data = json.dumps(body)
request.data = json.dumps(body).encode("utf-8")
request.get_method = lambda: "GET"
request_in_progress = True

Expand Down
16 changes: 8 additions & 8 deletions ambari-server/src/test/python/TestAmbariServer.py
Original file line number Diff line number Diff line change
Expand Up @@ -8736,7 +8736,7 @@ def test_ldap_sync_all(

self.assertEqual(url, str(request.get_full_url()))
self.assertEqual(
'[{"Event": {"specs": [{"principal_type": "users", "sync_type": "all"}, {"principal_type": "groups", "sync_type": "all"}]}}]',
b'[{"Event": {"specs": [{"principal_type": "users", "sync_type": "all"}, {"principal_type": "groups", "sync_type": "all"}]}}]',
request.data,
)

Expand Down Expand Up @@ -8791,7 +8791,7 @@ def test_ldap_sync_all_post_process_existing_users(

self.assertEqual(url, str(request.get_full_url()))
self.assertEqual(
'[{"Event": {"specs": [{"principal_type": "users", "sync_type": "all", "post_process_existing_users": "true"}, {"principal_type": "groups", "sync_type": "all", "post_process_existing_users": "true"}]}}]',
b'[{"Event": {"specs": [{"principal_type": "users", "sync_type": "all", "post_process_existing_users": "true"}, {"principal_type": "groups", "sync_type": "all", "post_process_existing_users": "true"}]}}]',
request.data,
)

Expand Down Expand Up @@ -8852,7 +8852,7 @@ def test_ldap_sync_users(
request = urlopen_mock.call_args_list[0][0][0]

self.assertEqual(
'[{"Event": {"specs": [{"principal_type": "users", "sync_type": "specific", "names": "bob, tom"}]}}]',
b'[{"Event": {"specs": [{"principal_type": "users", "sync_type": "specific", "names": "bob, tom"}]}}]',
request.data,
)

Expand Down Expand Up @@ -8913,7 +8913,7 @@ def test_ldap_sync_users_post_process_existing_users(
request = urlopen_mock.call_args_list[0][0][0]

self.assertEqual(
'[{"Event": {"specs": [{"principal_type": "users", "sync_type": "specific", "names": "bob, tom", "post_process_existing_users": "true"}]}}]',
b'[{"Event": {"specs": [{"principal_type": "users", "sync_type": "specific", "names": "bob, tom", "post_process_existing_users": "true"}]}}]',
request.data,
)

Expand Down Expand Up @@ -8974,7 +8974,7 @@ def test_ldap_sync_groups(
request = urlopen_mock.call_args_list[0][0][0]

self.assertEqual(
'[{"Event": {"specs": [{"principal_type": "groups", "sync_type": "specific", "names": "group1, group2"}]}}]',
b'[{"Event": {"specs": [{"principal_type": "groups", "sync_type": "specific", "names": "group1, group2"}]}}]',
request.data,
)

Expand Down Expand Up @@ -9035,7 +9035,7 @@ def test_ldap_sync_groups_post_process_existing_users(
request = urlopen_mock.call_args_list[0][0][0]

self.assertEqual(
'[{"Event": {"specs": [{"principal_type": "groups", "sync_type": "specific", "names": "group1, group2", "post_process_existing_users": "true"}]}}]',
b'[{"Event": {"specs": [{"principal_type": "groups", "sync_type": "specific", "names": "group1, group2", "post_process_existing_users": "true"}]}}]',
request.data,
)

Expand Down Expand Up @@ -9141,7 +9141,7 @@ def test_ldap_sync_existing(
request = urlopen_mock.call_args_list[0][0][0]

self.assertEqual(
'[{"Event": {"specs": [{"principal_type": "users", "sync_type": "existing"}, {"principal_type": "groups", "sync_type": "existing"}]}}]',
b'[{"Event": {"specs": [{"principal_type": "users", "sync_type": "existing"}, {"principal_type": "groups", "sync_type": "existing"}]}}]',
request.data,
)

Expand Down Expand Up @@ -9194,7 +9194,7 @@ def test_ldap_sync_existing_post_process_existing_users(
request = urlopen_mock.call_args_list[0][0][0]

self.assertEqual(
'[{"Event": {"specs": [{"principal_type": "users", "sync_type": "existing", "post_process_existing_users": "true"}, {"principal_type": "groups", "sync_type": "existing", "post_process_existing_users": "true"}]}}]',
b'[{"Event": {"specs": [{"principal_type": "users", "sync_type": "existing", "post_process_existing_users": "true"}, {"principal_type": "groups", "sync_type": "existing", "post_process_existing_users": "true"}]}}]',
request.data,
)

Expand Down