#NEWLINE# def get_service_by_role( self , role , cluster = None , instance = None ) : #NEWLINE# #INDENT# cm_cluster = None #NEWLINE# if cluster : #NEWLINE# #INDENT# cm_cluster = self . get_cloudera_cluster ( cluster ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if instance : #NEWLINE# #INDENT# cm_cluster = self . get_cloudera_cluster ( instance . cluster ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise ValueError ( _ ( "'cluster' or 'instance' argument missed" ) ) #NEWLINE# #UNINDENT# #UNINDENT# if ( role in [ 'NAMENODE' , 'DATANODE' , 'SECONDARYNAMENODE' , 'HDFS_GATEWAY' ] ) : #NEWLINE# #INDENT# return cm_cluster . get_service ( self . HDFS_SERVICE_NAME ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( role in [ 'RESOURCEMANAGER' , 'NODEMANAGER' , 'JOBHISTORY' , 'YARN_GATEWAY' ] ) : #NEWLINE# #INDENT# return cm_cluster . get_service ( self . YARN_SERVICE_NAME ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( role in [ 'OOZIE_SERVER' ] ) : #NEWLINE# #INDENT# return cm_cluster . get_service ( self . OOZIE_SERVICE_NAME ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( role in [ 'HIVESERVER2' , 'HIVEMETASTORE' , 'WEBHCAT' ] ) : #NEWLINE# #INDENT# return cm_cluster . get_service ( self . HIVE_SERVICE_NAME ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( role in [ 'HUE_SERVER' ] ) : #NEWLINE# #INDENT# return cm_cluster . get_service ( self . HUE_SERVICE_NAME ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( role in [ 'SPARK_YARN_HISTORY_SERVER' ] ) : #NEWLINE# #INDENT# return cm_cluster . get_service ( self . SPARK_SERVICE_NAME ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( role in [ 'SERVER' ] ) : #NEWLINE# #INDENT# return cm_cluster . get_service ( self . ZOOKEEPER_SERVICE_NAME ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( role in [ 'MASTER' , 'REGIONSERVER' ] ) : #NEWLINE# #INDENT# return cm_cluster . get_service ( self . HBASE_SERVICE_NAME ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise ValueError ( ( _ ( 'Process %(process)s is not supported by CDH plugin' ) % { #NEWLINE# #INDENT# 'process' : role , #NEWLINE# #UNINDENT# } ) )