Skip to content
This repository was archived by the owner on Apr 18, 2024. It is now read-only.

Commit 6935096

Browse files
committed
Added sanity check for cluster size during host detection, modified some output for formatting
1 parent 902cd63 commit 6935096

File tree

1 file changed

+39
-5
lines changed

1 file changed

+39
-5
lines changed

v6/scripts/deploy_on_oci.py

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,11 @@ def remote_host_detection():
523523

524524
except:
525525
pass
526-
print('\t%d found' % len(host_fqdn_list))
526+
if len(host_fqdn_list) < 1:
527+
print('\tCloudera Manager host not found!')
528+
sys.exit()
529+
else:
530+
print('\t%d found' % len(host_fqdn_list))
527531
# Master Host Detection
528532
x = 1
529533
print('->Lookup Master Hosts FQDN')
@@ -541,7 +545,11 @@ def remote_host_detection():
541545
host_ip_list.append(fqdn[3])
542546

543547
else:
544-
print('\t%d found' % (x - 1))
548+
if (x-1) < 2:
549+
print('\t%d Master hosts found, minimum 2 required!' % (x-1))
550+
sys.exit()
551+
else:
552+
print('\t%d found' % (x - 1))
545553
x = 0
546554

547555
except:
@@ -571,7 +579,11 @@ def remote_host_detection():
571579
host_ip_list.append(fqdn[3])
572580

573581
else:
574-
print('\t%d found' % (x - 1))
582+
if (x-1) < 3:
583+
print('\t%d Workers found, minimum 3 required!' % (x-1))
584+
sys.exit()
585+
else:
586+
print('\t%d found' % (x - 1))
575587
x = 0
576588

577589
except:
@@ -1172,7 +1184,7 @@ def push_rcg_config(config):
11721184
for service in cluster_service_list:
11731185
build_role_config_group_list(service)
11741186
message = 'Cluster Build Update'
1175-
print('->Updating ' + service + ' Configuration\n')
1187+
print('->Updating ' + service + ' Configuration')
11761188
if service == 'FLUME':
11771189
for rcg in role_config_group_list:
11781190
if rcg == 'FLUME-AGENT-BASE':
@@ -1746,7 +1758,7 @@ def create_role(rcg, rcg_roletype, service, host_id, hostname, rc):
17461758
role_api_packet = [cm_client.ApiRole(name=role_name, type=rcg_roletype, host_ref=host_ref,
17471759
role_config_group_ref=role_config_group_ref, service_ref=service_ref)]
17481760
body = cm_client.ApiRoleList(role_api_packet)
1749-
print('->Creating Role %s for %s' % (role_name, hostname))
1761+
print('--->Creating Role %s for %s' % (role_name, hostname))
17501762

17511763
try:
17521764
api_response = roles_api.create_roles(cluster_name, service, body=body)
@@ -2362,6 +2374,25 @@ def generate_kerberos_credentials():
23622374
print('Exception calling ClouderaManagerResourceApi->generate_credentials_command: {}'.format(e))
23632375

23642376

2377+
def hdfs_enable_ha():
2378+
"""
2379+
Enable high availability (HA) for an HDFS NameNode.
2380+
2381+
The command will set up the given "active" and "stand-by" NameNodes as an HA pair. Both nodes need to already exist.
2382+
2383+
If there is a SecondaryNameNode associated with either given NameNode instance, it will be deleted.
2384+
2385+
Note that while the shared edits path may be different for both nodes,
2386+
they need to point to the same underlying storage
2387+
2388+
As part of enabling HA, any services that depend on the HDFS service being modified will be stopped.
2389+
The command arguments provide options to re-start these services and to re-deploy the client configurations for
2390+
services of the cluster after HA has been enabled.
2391+
:return:
2392+
"""
2393+
2394+
2395+
23652396
#
23662397
# END SECONDARY FUNCTIONS
23672398
#
@@ -2443,6 +2474,9 @@ def build_cloudera_cluster():
24432474
if input_host_list == 'None':
24442475
print('->No input host list found, running remote detection via SSH')
24452476
remote_host_detection()
2477+
if len(host_fqdn_list) < 6:
2478+
print('Error - %d hosts found, Minimum 6 required to build %s!' % (len(host_fqdn_list), cluster_name))
2479+
sys.exit()
24462480

24472481
else:
24482482
print('->Input host list found: %s' % input_host_list)

0 commit comments

Comments
 (0)