Skip to content

Commit

Permalink
RANGER-4747: Add exception handling in docker based service creation (a…
Browse files Browse the repository at this point in the history
…pache#300)

RANGER-4747: added exception handling in service creation during docker setup

Co-authored-by: abhishek-kumar <[email protected]>
  • Loading branch information
kumaab and abhishek-kumar authored Mar 13, 2024
1 parent d8956c1 commit 05cba73
Showing 1 changed file with 9 additions and 24 deletions.
33 changes: 9 additions & 24 deletions dev-support/ranger-docker/scripts/create-ranger-services.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,27 +58,12 @@ def service_not_exists(service):
'jdbc.url': 'jdbc:trino://ranger-trino:8080',
}})

if service_not_exists(hdfs):
ranger_client.create_service(hdfs)
print('HDFS service created!')
if service_not_exists(yarn):
ranger_client.create_service(yarn)
print('Yarn service created!')
if service_not_exists(hive):
ranger_client.create_service(hive)
print('Hive service created!')
if service_not_exists(hbase):
ranger_client.create_service(hbase)
print('HBase service created!')
if service_not_exists(kafka):
ranger_client.create_service(kafka)
print('Kafka service created!')
if service_not_exists(knox):
ranger_client.create_service(knox)
print('Knox service created!')
if service_not_exists(kms):
ranger_client.create_service(kms)
print('KMS service created!')
if service_not_exists(trino):
ranger_client.create_service(trino)
print('Trino service created!')
services = [hdfs, yarn, hive, hbase, kafka, knox, kms, trino]
for service in services:
try:
if service_not_exists(service):
ranger_client.create_service(service)
print(f" {service.name} service created!")
except Exception as e:
print(f"An exception occured: {e}")

0 comments on commit 05cba73

Please sign in to comment.