def hiveserver2_jdbc_url(): is_transport_mode_http = hiveserver2_transport_mode() == 'HTTP' urlbase = 'jdbc:hive2://%s:%s/default' % ( beeswax.conf.HIVE_SERVER_HOST.get(), hiveserver2_thrift_http_port() if is_transport_mode_http else beeswax.conf.HIVE_SERVER_PORT.get()) if get_conf().get(_CNF_HIVESERVER2_USE_SSL, 'FALSE').upper() == 'TRUE': urlbase += ';ssl=true' if get_conf().get(_CNF_HIVESERVER2_TRUSTSTORE_PATH): urlbase += ';sslTrustStore=%s' % get_conf().get( _CNF_HIVESERVER2_TRUSTSTORE_PATH) elif get_trustore_location(): urlbase += ';sslTrustStore=%s' % get_trustore_location() if get_conf().get(_CNF_HIVESERVER2_TRUSTSTORE_PASSWORD): urlbase += ';trustStorePassword=%s' % get_conf().get( _CNF_HIVESERVER2_TRUSTSTORE_PASSWORD) elif get_trustore_password(): urlbase += ';trustStorePassword=%s' % get_trustore_password() if is_transport_mode_http: urlbase += ';transportMode=http' urlbase += ';httpPath=%s' % hiveserver2_thrift_http_path() return urlbase
def hiveserver2_jdbc_url(): urlbase = 'jdbc:hive2://%s:%s/default' % (beeswax.conf.HIVE_SERVER_HOST.get(), beeswax.conf.HIVE_SERVER_PORT.get()) if get_conf().get(_CNF_HIVESERVER2_USE_SSL, 'FALSE').upper() == 'TRUE': urlbase += ';ssl=true' if get_conf().get(_CNF_HIVESERVER2_TRUSTSTORE_PATH): urlbase += ';sslTrustStore=%s' % get_conf().get(_CNF_HIVESERVER2_TRUSTSTORE_PATH) elif get_trustore_location(): urlbase += ';sslTrustStore=%s' % get_trustore_location() if get_conf().get(_CNF_HIVESERVER2_TRUSTSTORE_PASSWORD): urlbase += ';trustStorePassword=%s' % get_conf().get(_CNF_HIVESERVER2_TRUSTSTORE_PASSWORD) return urlbase
def test_ssl_client_site(): hadoop_home = tempfile.mkdtemp() finish = None try: xml = """<?xml version="1.0" encoding="UTF-8"?> <configuration> <property> <name>ssl.client.truststore.location</name> <value>/etc/cdep-ssl-conf/CA_STANDARD/truststore.jks</value> </property> <property> <name>ssl.client.truststore.password</name> <value>cloudera</value> </property> <property> <name>ssl.client.truststore.type</name> <value>jks</value> </property> <property> <name>ssl.client.truststore.reload.interval</name> <value>10000</value> </property> </configuration> """ file(os.path.join(hadoop_home, 'ssl-client.xml'), 'w').write(xml) finish = conf.HDFS_CLUSTERS['default'].HADOOP_CONF_DIR.set_for_testing( hadoop_home) ssl_client_site.reset() assert_equal('/etc/cdep-ssl-conf/CA_STANDARD/truststore.jks', ssl_client_site.get_trustore_location()) finally: ssl_client_site.reset() if finish: finish()
def test_ssl_client_site(): hadoop_home = tempfile.mkdtemp() finish = None try: xml = """<?xml version="1.0" encoding="UTF-8"?> <configuration> <property> <name>ssl.client.truststore.location</name> <value>/etc/cdep-ssl-conf/CA_STANDARD/truststore.jks</value> </property> <property> <name>ssl.client.truststore.password</name> <value>cloudera</value> </property> <property> <name>ssl.client.truststore.type</name> <value>jks</value> </property> <property> <name>ssl.client.truststore.reload.interval</name> <value>10000</value> </property> </configuration> """ file(os.path.join(hadoop_home, 'ssl-client.xml'), 'w').write(xml) finish = conf.HDFS_CLUSTERS['default'].HADOOP_CONF_DIR.set_for_testing(hadoop_home) ssl_client_site.reset() assert_equal('/etc/cdep-ssl-conf/CA_STANDARD/truststore.jks', ssl_client_site.get_trustore_location()) finally: ssl_client_site.reset() if finish: finish()