本文整理汇总了Python中modules.util.log.LogFactory.info方法的典型用法代码示例。如果您正苦于以下问题:Python LogFactory.info方法的具体用法?Python LogFactory.info怎么用?Python LogFactory.info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类modules.util.log.LogFactory
的用法示例。
在下文中一共展示了LogFactory.info方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run_plugin
# 需要导入模块: from modules.util.log import LogFactory [as 别名]
# 或者: from modules.util.log.LogFactory import info [as 别名]
def run_plugin(self, values):
log = LogFactory().get_log(__name__)
# wait till SAML_ENDPOINT becomes available
mds_response = None
while mds_response is None:
log.debug("Waiting for SAML_ENDPOINT to be available from metadata service for app ID: %s" % values["APPLICATION_ID"])
time.sleep(5)
mds_response = mdsclient.get(app=True)
if mds_response is not None and mds_response.properties.get("SAML_ENDPOINT") is None:
mds_response = None
saml_endpoint = mds_response.properties["SAML_ENDPOINT"]
log.debug("SAML_ENDPOINT value read from Metadata service: %s" % saml_endpoint)
# start tomcat
tomcat_start_command = "exec /opt/tomcat/bin/startup.sh"
log.info("Starting Tomcat server: [command] %s, [STRATOS_SAML_ENDPOINT] %s" % (tomcat_start_command, saml_endpoint))
env_var = os.environ.copy()
env_var["STRATOS_SAML_ENDPOINT"] = saml_endpoint
env_var["STRATOS_HOST_NAME"] = values["HOST_NAME"]
payload_ports = values["PORT_MAPPINGS"].split("|")
if values.get("LB_CLUSTER_ID") is not None:
port_no = payload_ports[2].split(":")[1]
else:
port_no = payload_ports[1].split(":")[1]
env_var["STRATOS_HOST_PORT"] = port_no
p = subprocess.Popen(tomcat_start_command, env=env_var, shell=True)
output, errors = p.communicate()
log.debug("Tomcat server started")
示例2: MessageBrokerHeartBeatChecker
# 需要导入模块: from modules.util.log import LogFactory [as 别名]
# 或者: from modules.util.log.LogFactory import info [as 别名]
class MessageBrokerHeartBeatChecker(AbstractAsyncScheduledTask):
"""
A scheduled task to periodically check if the connected message broker is online.
If the message broker goes offline, it will disconnect the currently connected
client object and it will return from the loop_forever() method.
"""
def __init__(self, connected_client, mb_ip, mb_port, username=None, password=None):
self.__mb_client = mqtt.Client()
if username is not None:
self.__mb_client.username_pw_set(username, password)
self.__mb_ip = mb_ip
self.__mb_port = mb_port
self.__connected_client = connected_client
self.__log = LogFactory().get_log(__name__)
def execute_task(self):
try:
self.__mb_client.connect(self.__mb_ip, self.__mb_port, 60)
self.__mb_client.disconnect()
except Exception:
self.__log.info(
"Message broker %s:%s cannot be reached. Disconnecting client..." % (self.__mb_ip, self.__mb_port))
self.__connected_client.disconnect()
示例3: export_env_var
# 需要导入模块: from modules.util.log import LogFactory [as 别名]
# 或者: from modules.util.log.LogFactory import info [as 别名]
def export_env_var(self, variable, value):
log = LogFactory().get_log(__name__)
if value is not None:
os.environ[variable] = value
log.info("Exported environment variable %s: %s" % (variable, value))
else:
log.warn("Could not export environment variable %s " % variable)
示例4: run_plugin
# 需要导入模块: from modules.util.log import LogFactory [as 别名]
# 或者: from modules.util.log.LogFactory import info [as 别名]
def run_plugin(self, values):
log = LogFactory().get_log(__name__)
log.info("Reading the Complete Topology in order to get the dependent ip addresses ...")
topology = values["TOPOLOGY_JSON"]
topology_str = json.loads(topology)
master_ip = None
if topology_str is not None:
# add service map
for service_name in topology_str["serviceMap"]:
service_str = topology_str["serviceMap"][service_name]
if service_name == "hadoop" :
# add cluster map
for cluster_id in service_str["clusterIdClusterMap"]:
cluster_str = service_str["clusterIdClusterMap"][cluster_id]
# add member map
for member_id in cluster_str["memberMap"]:
member_str = cluster_str["memberMap"][member_id]
if master_ip is None:
master_ip = member_str["defaultPrivateIP"]
os.environ["CONFIG_PARAM_HADOOP_MASTER"] = master_ip
log.info("configured master ip - ")
log.info(master_ip)
# configure server
log.info("Configuring Hadoop...")
config_command = "python /opt/ppaas-configurator-4.1.0-SNAPSHOT/configurator.py"
env_var = os.environ.copy()
p = subprocess.Popen(config_command, env=env_var, shell=True)
output, errors = p.communicate()
log.info("Hadoop configured successfully")
示例5: run_plugin
# 需要导入模块: from modules.util.log import LogFactory [as 别名]
# 或者: from modules.util.log.LogFactory import info [as 别名]
def run_plugin(self, values):
log = LogFactory().get_log(__name__)
# start tomcat
tomcat_start_command = "exec ${CATALINA_HOME}/bin/startup.sh"
log.info("Starting Tomcat server: [command] %s" % tomcat_start_command)
p = subprocess.Popen(tomcat_start_command, shell=True)
output, errors = p.communicate()
log.debug("Tomcat server started: [command] %s, [output] %s" % (p.args, output))
示例6: checkout
# 需要导入模块: from modules.util.log import LogFactory [as 别名]
# 或者: from modules.util.log.LogFactory import info [as 别名]
def checkout(self, repo_info):
log = LogFactory().get_log(__name__)
try:
log.info("Running extension for checkout job")
repo_info = values['REPO_INFO']
git_repo = AgentGitHandler.create_git_repo(repo_info)
AgentGitHandler.add_repo(git_repo)
except Exception as e:
log.exception("Error while executing CheckoutJobHandler extension: %s" % e)
示例7: run_plugin
# 需要导入模块: from modules.util.log import LogFactory [as 别名]
# 或者: from modules.util.log.LogFactory import info [as 别名]
def run_plugin(self, values):
log = LogFactory().get_log(__name__)
# start server
log.info("Starting APACHE STORM SUPERVISOR...")
start_command = "${CARBON_HOME}/bin/storm supervisor"
env_var = os.environ.copy()
p = subprocess.Popen(start_command, env=env_var, shell=True)
output, errors = p.communicate()
log.debug("APACHE STORM SUPERVISOR started successfully")
示例8: run_plugin
# 需要导入模块: from modules.util.log import LogFactory [as 别名]
# 或者: from modules.util.log.LogFactory import info [as 别名]
def run_plugin(self, values):
log = LogFactory().get_log(__name__)
os.environ["GIT_SSL_NO_VERIFY"] = "1"
s2gitDomain = values.get("S2GIT_DOMAIN")
s2gitIP = values.get("S2GIT_IP")
entry_command = "echo '"+ s2gitIP + " "+ s2gitDomain + "' >> /etc/hosts"
env_var = os.environ.copy()
p = subprocess.Popen(entry_command, env=env_var, shell=True)
output, errors = p.communicate()
log.info("S2git host entry added successfully")
示例9: run_plugin
# 需要导入模块: from modules.util.log import LogFactory [as 别名]
# 或者: from modules.util.log.LogFactory import info [as 别名]
def run_plugin(self, values):
log = LogFactory().get_log(__name__)
log.info("Reading environment variables...")
clustering_enable= os.environ.get('CLUSTER')
log.info(clustering_enable)
if clustering_enable == 'true':
# start server
log.info("Starting Hadoop Namenode ...")
format_namenode_command = "exec ${HADOOP_HOME}/bin/hadoop namenode -format"
env_var = os.environ.copy()
p = subprocess.Popen(format_namenode_command, env=env_var, shell=True)
output, errors = p.communicate()
start_command = "exec ${HADOOP_HOME}/sbin/start-all.sh"
env_var = os.environ.copy()
p = subprocess.Popen(start_command, env=env_var, shell=True)
output, errors = p.communicate()
log.debug("Hadoop Namenode started successfully")
else:
# start server
log.info("Starting Hadoop Datanode ...")
start_command = "exec ${HADOOP_HOME}/sbin/hadoop-daemon.sh start datanode"
env_var = os.environ.copy()
p = subprocess.Popen(start_command, env=env_var, shell=True)
output, errors = p.communicate()
log.debug("Hadoop Datanode started successfully")
示例10: run_plugin
# 需要导入模块: from modules.util.log import LogFactory [as 别名]
# 或者: from modules.util.log.LogFactory import info [as 别名]
def run_plugin(self, values):
log = LogFactory().get_log(__name__)
event_name = values["EVENT"]
log.debug("Running extension for %s" % event_name)
extension_values = {}
for key in values.keys():
extension_values["STRATOS_" + key] = values[key]
# log.debug("%s => %s" % ("STRATOS_" + key, extension_values["STRATOS_" + key]))
try:
output, errors = ExtensionExecutor.execute_script(event_name + ".sh")
except OSError:
raise RuntimeError("Could not find an extension file for event %s" % event_name)
if len(errors) > 0:
raise RuntimeError("Extension execution failed for script %s: %s" % (event_name, errors))
log.info("%s Extension executed. [output]: %s" % (event_name, output))
示例11: run_plugin
# 需要导入模块: from modules.util.log import LogFactory [as 别名]
# 或者: from modules.util.log.LogFactory import info [as 别名]
def run_plugin(self, values):
log = LogFactory().get_log(__name__)
log.info("Reading port mappings...")
port_mappings_str = values["PORT_MAPPINGS"]
mgt_console_https_port = None
# port mappings format: """NAME:mgt-console|PROTOCOL:https|PORT:4500|PROXY_PORT:9443"""
log.info("Port mappings: %s" % port_mappings_str)
if port_mappings_str is not None:
port_mappings_array = port_mappings_str.split(";")
if port_mappings_array:
for port_mapping in port_mappings_array:
log.debug("port_mapping: %s" % port_mapping)
name_value_array = port_mapping.split("|")
name = name_value_array[0].split(":")[1]
protocol = name_value_array[1].split(":")[1]
port = name_value_array[2].split(":")[1]
if name == "mgt-console" and protocol == "https":
mgt_console_https_port = port
log.info("Kubernetes service management console https port: %s" % mgt_console_https_port)
if mgt_console_https_port is not None:
command = "sed -i \"s/^#CONFIG_PARAM_HTTPS_PROXY_PORT = .*/CONFIG_PARAM_HTTPS_PROXY_PORT = %s/g\" %s" % (mgt_console_https_port, "${CONFIGURATOR_HOME}/template-modules/wso2cep-4.0.0/module.ini")
p = subprocess.Popen(command, shell=True)
output, errors = p.communicate()
log.info("Successfully updated management console https proxy port: %s in CEP template module" % mgt_console_https_port)
# start server
log.info("Starting WSO2 CEP...")
start_command = "exec ${CARBON_HOME}/bin/wso2server.sh start"
env_var = os.environ.copy()
p = subprocess.Popen(start_command, env=env_var, shell=True)
output, errors = p.communicate()
log.debug("WSO2 CEP started successfully")
示例12: run_plugin
# 需要导入模块: from modules.util.log import LogFactory [as 别名]
# 或者: from modules.util.log.LogFactory import info [as 别名]
def run_plugin(self, values):
log = LogFactory().get_log(__name__)
MYSQL_ROOT_PASSWORD = os.environ["MYSQL_ROOT_PASSWORD"];
TEMP_FILE_PATH="/tmp/temp.sql"
log.info("MYSQL_ROOT_PASSWORD : %s" % MYSQL_ROOT_PASSWORD)
f = open(TEMP_FILE_PATH, "w+")
f.write(
"USE mysql;\n"
"FLUSH PRIVILEGES;\n"
"GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;\n"
"UPDATE user SET password=PASSWORD('" + MYSQL_ROOT_PASSWORD + "') WHERE user='root';")
f.close()
log.info("Temp File created")
mysql_command = "/usr/sbin/mysqld --bootstrap --verbose=0 < "+TEMP_FILE_PATH
env_var = os.environ.copy()
p = subprocess.Popen(mysql_command, env=env_var, shell=True)
output, errors = p.communicate()
log.info("%s file executed" %TEMP_FILE_PATH)
mysql_start_command = "service mysql restart"
p = subprocess.Popen(mysql_start_command, env=env_var, shell=True)
output, errors = p.communicate()
log.debug("mysql started successfully")
# get local ip as to export to metadata
get_local_ip_cmd = "awk 'NR==1 {print $1}' /etc/hosts"
local_ip = subprocess.check_output(get_local_ip_cmd, shell=True)
if local_ip is not None:
local_ip = local_ip[0:-1]
log.info("local IP from /etc/hosts : %s " % local_ip)
# publishing to metadata service
mysql_host = {"key": "MYSQL_HOST", "values": local_ip}
mysql_password = {"key": "MYSQL_ROOT_PASSWORD", "values": MYSQL_ROOT_PASSWORD}
mysql_username = {"key": "MYSQL_ROOT_USERNAME", "values": "root"}
self.publish_metadata(mysql_host)
self.publish_metadata(mysql_username)
self.publish_metadata(mysql_password)
示例13: run_plugin
# 需要导入模块: from modules.util.log import LogFactory [as 别名]
# 或者: from modules.util.log.LogFactory import info [as 别名]
def run_plugin(self, values):
log = LogFactory().get_log(__name__)
# configure server
log.info("Configuring APACHE STORM UI...")
config_command = "exec /opt/ppaas-configurator-4.1.0-SNAPSHOT/configurator.py"
env_var = os.environ.copy()
p = subprocess.Popen(config_command, env=env_var, shell=True)
output, errors = p.communicate()
log.info("APACHE STORM UI configured successfully")
# start server
log.info("Starting APACHE STORM UI...")
start_command = "${CARBON_HOME}/bin/storm ui"
env_var = os.environ.copy()
p = subprocess.Popen(start_command, env=env_var, shell=True)
output, errors = p.communicate()
log.debug("APACHE STORM UI started successfully")
示例14: run_plugin
# 需要导入模块: from modules.util.log import LogFactory [as 别名]
# 或者: from modules.util.log.LogFactory import info [as 别名]
def run_plugin(self, values):
log = LogFactory().get_log(__name__)
log.info("Starting tomcat metadata publisher...")
# publish callback and issuer id from tomcat for IS to pickup
publish_data = mdsclient.MDSPutRequest()
# hostname_entry = {"key": "TOMCAT_HOSTNAME", "values": member_hostname}
cluster_hostname = values["HOST_NAME"]
log.info("Reading port mappings...")
port_mappings_str = values["PORT_MAPPINGS"]
tomcat_http_port = None
# port mappings format: """NAME:mgt-console|PROTOCOL:https|PORT:4500|PROXY_PORT:8443;
# NAME:tomcat-http|PROTOCOL:http|PORT:4501|PROXY_PORT:7280;"""
log.info("Port mappings: %s" % port_mappings_str)
if port_mappings_str is not None:
port_mappings_array = port_mappings_str.split(";")
if port_mappings_array:
for port_mapping in port_mappings_array:
log.debug("port_mapping: %s" % port_mapping)
name_value_array = port_mapping.split("|")
name = name_value_array[0].split(":")[1]
protocol = name_value_array[1].split(":")[1]
port = name_value_array[2].split(":")[1]
if name == "tomcat-http" and protocol == "http":
tomcat_http_port = port
log.info("Kubernetes service port of tomcat http transport: %s" % tomcat_http_port)
callback_url = "http://%s:%s/travelocity.com/home.jsp" % (cluster_hostname, tomcat_http_port)
callback_url_property = {"key": "CALLBACK_URL", "values": [callback_url]}
mdsclient.put(callback_url_property, app=True)
log.info("Published property to metadata API: CALLBACK_URL: %s" % callback_url)
issuer_property = {"key": "SSO_ISSUER", "values": ["travelocity.com"]}
mdsclient.put(issuer_property, app=True)
log.info("Published property to metadata API: SSO_ISSUER: travelocity.com")
log.info("Tomcat metadata publisher completed")
示例15: run_plugin
# 需要导入模块: from modules.util.log import LogFactory [as 别名]
# 或者: from modules.util.log.LogFactory import info [as 别名]
def run_plugin(self, values):
log = LogFactory().get_log(__name__)
log.info("Reading the Complete Topology in order to get the dependent ip addresses ...")
topology_str = values["TOPOLOGY_JSON"]
log.info("Port mappings: %s" % topology_str)
zookeeper_member_default_private_ip = None
nimbus_member_default_private_ip = None
if topology_str is not None:
# add service map
for service_name in topology_str["serviceMap"]:
service_str = topology_str["serviceMap"][service_name]
if service_name == "zookeeper" :
# add cluster map
for cluster_id in service_str["clusterIdClusterMap"]:
cluster_str = service_str["clusterIdClusterMap"][cluster_id]
# add member map
for member_id in cluster_str["memberMap"]:
member_str = cluster_str["memberMap"][member_id]
if zookeeper_member_default_private_ip is None:
zookeeper_member_default_private_ip = member_str["defaultPrivateIP"]
if service_name == "nimbus" :
# add cluster map
for cluster_id in service_str["clusterIdClusterMap"]:
cluster_str = service_str["clusterIdClusterMap"][cluster_id]
# add member map
for member_id in cluster_str["memberMap"]:
member_str = cluster_str["memberMap"][member_id]
if nimbus_member_default_private_ip is None:
nimbus_member_default_private_ip = member_str["defaultPrivateIP"]
if zookeeper_member_default_private_ip is not None:
command = "sed -i \"s/^#ZOOKEEPER_HOSTNAME = .*/ZOOKEEPER_HOSTNAME = %s/g\" %s" % (zookeeper_member_default_private_ip, "${CONFIGURATOR_HOME}/template-modules/apache-storm-0.9.5/module.ini")
p = subprocess.Popen(command, shell=True)
output, errors = p.communicate()
log.info("Successfully updated zookeeper hostname: %s in Apache Storm template module" % zookeeper_member_default_private_ip)
if nimbus_member_default_private_ip is not None:
command = "sed -i \"s/^#ZOOKEEPER_HOSTNAME = .*/ZOOKEEPER_HOSTNAME = %s/g\" %s" % (nimbus_member_default_private_ip, "${CONFIGURATOR_HOME}/template-modules/apache-storm-0.9.5/module.ini")
p = subprocess.Popen(command, shell=True)
output, errors = p.communicate()
log.info("Successfully updated nimbus hostname: %s in Apache Storm template module" % nimbus_member_default_private_ip)
# configure server
log.info("Configuring Apache Storm Supervisor...")
config_command = "exec /opt/ppaas-configurator-4.1.0-SNAPSHOT/configurator.py"
env_var = os.environ.copy()
p = subprocess.Popen(config_command, env=env_var, shell=True)
output, errors = p.communicate()
log.info("Apache Storm configured successfully")
# start server
log.info("Starting Apache Storm...")
start_command = "exec ${CARBON_HOME}/bin/storm supervisor"
env_var = os.environ.copy()
p = subprocess.Popen(start_command, env=env_var, shell=True)
output, errors = p.communicate()
log.debug("Apache Storm started successfully")