当前位置: 首页>>代码示例>>Python>>正文


Python OSConf.get_app_uuid方法代码示例

本文整理汇总了Python中OSConf.get_app_uuid方法的典型用法代码示例。如果您正苦于以下问题:Python OSConf.get_app_uuid方法的具体用法?Python OSConf.get_app_uuid怎么用?Python OSConf.get_app_uuid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OSConf的用法示例。


在下文中一共展示了OSConf.get_app_uuid方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: expose_port

# 需要导入模块: import OSConf [as 别名]
# 或者: from OSConf import get_app_uuid [as 别名]
    def expose_port(self, app_name):
        global HOST
        global PORT
        uuid = OSConf.get_app_uuid(app_name)
        cmd = '/usr/libexec/openshift/cartridges/%s/info/hooks/expose-port %s %s %s ' % (common.app_types[self.app_type], app_name, common.get_domain_name(), uuid)
        (status, output) = common.run_remote_cmd(None, cmd, as_root=True)

        if status != 0:
            return status

        obj = re.search(r".*PROXY_HOST=(.*)", output, re.MULTILINE)
        if obj:
            host=obj.group(1)
            obj = re.search(r".*PROXY_PORT=(\d+)", output, re.MULTILINE)
            if obj:
                HOST= host
                PORT = obj.group(1)
            else:
                print "ERROR: Unable to catpure PROXY_PORT"
                return -1
        else:
            print "ERROR: Unable to catpure PROXY_HOST"
            return -1

        return status
开发者ID:xiama,项目名称:automations,代码行数:27,代码来源:public_tcp_proxy.py

示例2: change_mem_limit

# 需要导入模块: import OSConf [as 别名]
# 或者: from OSConf import get_app_uuid [as 别名]
 def change_mem_limit(self):
     #res_limit_file = "/var/lib/openshift/%s/%s/configuration/etc/php.ini"%(OSConf.get_app_uuid(self.app_name), "".join([a for a in common.app_types[self.app_type] if a.isalpha()]))
     res_limit_file = "/var/lib/openshift/%s/%s/configuration/etc/php.ini"%(OSConf.get_app_uuid(self.app_name),self.app_type)
     command = "sed -i -e 's/^memory_limit=.*/memory_limit=1280M/' %s"%res_limit_file
     #(status, output) = common.run_remote_cmd(None, command, as_root=True)
     (status, output) = common.run_remote_cmd(self.app_name, command, as_root=True)
     return status
开发者ID:xiama,项目名称:automations,代码行数:9,代码来源:memory_swap.py

示例3: repquota

# 需要导入模块: import OSConf [as 别名]
# 或者: from OSConf import get_app_uuid [as 别名]
 def repquota(self):
     cmd = "repquota /var/ | awk '/^%s/{ print $5 }' "%OSConf.get_app_uuid(self.app_name)
     (status, output) = common.run_remote_cmd_as_root(cmd)
     obj = re.search(r"1048576", output)
     if obj:
         return 0
     return  1
开发者ID:xiama,项目名称:automations,代码行数:9,代码来源:change_std_gear.py

示例4: verify

# 需要导入模块: import OSConf [as 别名]
# 或者: from OSConf import get_app_uuid [as 别名]
    def verify(self, app_name, hook_name, expected_re=None, expected_return=None):
        uuid = OSConf.get_app_uuid(app_name)
        cmd = '''cd /usr/libexec/openshift/cartridges/embedded/%s/info/hooks && ./%s %s %s %s '''%(common.cartridge_types['mysql'], hook_name, app_name, self.domain_name, uuid)
        (status, output) = common.run_remote_cmd(None, cmd, as_root=True)
        #this is stronger condition
        if (expected_re!=None):
            obj = re.search(r"%s"%expected_re, output)
            if obj:
                if (hook_name=='expose-port'):
                    obj = re.search(r"PROXY_HOST=(.*)",output)
                    obj2 = re.search(r"PROXY_PORT=(.*)",output)
                    if (obj and obj2):
                        self.proxy_host = obj.group(1)
                        self.proxy_port = obj2.group(1)
                    else:
                        print "WARNING: Unable to capture PROXY_HOST from output..."
                return 0
            else:
                return 1

        if (expected_return!=None):
            if status==expected_return:
                return 0
            else:
                return 1
        print "WARNING: Nothing to verify?"
        return 1
开发者ID:xiama,项目名称:automations,代码行数:29,代码来源:expose_conceal_port_hooks.py

示例5: check_res

# 需要导入模块: import OSConf [as 别名]
# 或者: from OSConf import get_app_uuid [as 别名]
    def check_res(self):
        uuid = []
        for i in range(self.num_apps):
            uuid.append(OSConf.get_app_uuid("%s%s"%(self.app_name,i)))

        cmd = [
               "sleep 0.5",
               "ps -ef",
               "grep '/bin/bash /etc/init.d/libra restartuser'",
               "grep -v grep >>/tmp/.abc"]

        cmd2 = ["cat /tmp/.abc ",
                "egrep '%s'"%("|".join(uuid)),
                "sort -k 6",
                "uniq -f 6",
                """awk '{lines++}END{print "APPS=" lines}'"""]
        (status, output) = common.run_remote_cmd_as_root(
               "rm -rf /tmp/.abc "
               + " ; "
               + " for i in `seq 0 120`; do "+"|".join(cmd)+";done "
               + " ; "
               + "|".join(cmd2)
               + ";rm -f /tmp/.abc"
               )
        obj = re.search(r"APPS=%s"%self.num_apps, output)
        if status==0 and obj:
            return 0
        else: 
            return 1
开发者ID:xiama,项目名称:automations,代码行数:31,代码来源:apps_when_libra_service_restart.py

示例6: finalize

# 需要导入模块: import OSConf [as 别名]
# 或者: from OSConf import get_app_uuid [as 别名]
 def finalize(self):
     self.remove_apps_from_mongo()
     for app_name in [ self.app_name, self.app_name2 ]:
         uuid = OSConf.get_app_uuid(app_name)
         app_url = OSConf.get_app_url(app_name)
         common.destroy_app(app_name)
         if uuid != 1:
             common.run_remote_cmd_as_root("rm -Rf /var/lib/openshift/%s" % uuid, app_url)
             common.run_remote_cmd_as_root("rm -Rf /var/lib/openshift/%s-*" % app_name, app_url)
开发者ID:xiama,项目名称:automations,代码行数:11,代码来源:rhc_admin_check.py

示例7: exposing_port

# 需要导入模块: import OSConf [as 别名]
# 或者: from OSConf import get_app_uuid [as 别名]
 def exposing_port(self, cartridge):
     return common.run_remote_cmd_as_root(
         "/usr/libexec/openshift/cartridges/embedded/%s/info/hooks/expose-port %s %s %s" %
         (
             cartridge,
             self.app_name,
             self.domain_name,
             OSConf.get_app_uuid(self.app_name)
         )
     )[0]
开发者ID:xiama,项目名称:automations,代码行数:12,代码来源:non_scalable_app_exposing_port.py

示例8: check_softlink

# 需要导入模块: import OSConf [as 别名]
# 或者: from OSConf import get_app_uuid [as 别名]
 def check_softlink(self):
     self.app_uuid = OSConf.get_app_uuid(self.app_name)
     exp_str = "xx.xml -> /var/lib/openshift/%s/app-root/runtime/repo/.openshift/config/xx.xml" % (self.app_uuid)
     cmd = "cd %s/jbossas-7/jbossas-7/standalone/configuration && ls -l" % (self.app_uuid)
     (ret, output) = common.command_getstatusoutput(cmd)
     if ret == 0 and output.find(exp_str) != -1:
         self.info("Successfully find '%s' in the output" % (exp_str))
         return 0
     else:
         self.info("Failed to find '%s' in the output" % (exp_str))
         return 1
开发者ID:xiama,项目名称:automations,代码行数:13,代码来源:configuration_files_referceable_in_standalone_xml.py

示例9: do_changes

# 需要导入模块: import OSConf [as 别名]
# 或者: from OSConf import get_app_uuid [as 别名]
    def do_changes(self, app_name):
        uuid= OSConf.get_app_uuid(app_name)
        try:
            cmd = "echo Jn316 >> /var/lib/openshift/%s/%s/logs/error_log-*"%(uuid, app_name)
            (status, output) = common.run_remote_cmd(None, cmd, True)
            cmd = "echo Jn316 >> /var/lib/openshift/%s/%s/logs/access_log-*"%(uuid, app_name)
            (status, output) = common.run_remote_cmd(None, cmd, True)
        except:
            return 1

        return 0
开发者ID:xiama,项目名称:automations,代码行数:13,代码来源:rhc_tail_files_check_RED.py

示例10: check_the_cron

# 需要导入模块: import OSConf [as 别名]
# 或者: from OSConf import get_app_uuid [as 别名]
 def check_the_cron(self):
     self.info("Waiting for a minute to get some results from cron...")
     uuid = OSConf.get_app_uuid(self.app_name)
     app_url = OSConf.get_app_url(self.app_name)
     time.sleep(65)
     p = pexpect.spawn('ssh -t -o ConnectTimeout=20 %[email protected]%s "cat $OPENSHIFT_DATA_DIR/date.txt"' % (uuid, app_url))
     p.wait()
     try:
         ret = p.expect("\d{2}:\d{2}:\d{2}@\d{4}-\d{2}-\d{2}")
         return ret
     except pexpect.TIMEOUT, e:
         print "Failed to find data generated by cron job. %s" % (e)
开发者ID:xiama,项目名称:automations,代码行数:14,代码来源:cron_embed.py

示例11: verify_cgroup_threshold

# 需要导入模块: import OSConf [as 别名]
# 或者: from OSConf import get_app_uuid [as 别名]
    def verify_cgroup_threshold(self, app_name, gear_size):

        thresholds = {
            "small" : { "memory" : 536870912, "swap" : 641728512, "cpu" : 128 },
            "medium" : { "memory" : 1073741824, "swap" : 1178599424, "cpu" : 128 },
            #"large" : { "memory" : 2147483648, "swap" : 2252341248, "cpu" : 128 },  #not supported
        }
        uuid = OSConf.get_app_uuid(app_name)

        if common.get_cgroup_threshold(uuid, "memory", "limit_in_bytes") == thresholds[gear_size]["memory"] and common.get_cgroup_threshold(uuid, "memory", "memsw.limit_in_bytes") == thresholds[gear_size]["swap"] and common.get_cgroup_threshold(uuid, "cpu", "shares") == thresholds[gear_size]["cpu"]:
            return True # Success, it's a Python function
        else:
            return False # Failure
开发者ID:xiama,项目名称:automations,代码行数:15,代码来源:gear_size.py

示例12: do_changes

# 需要导入模块: import OSConf [as 别名]
# 或者: from OSConf import get_app_uuid [as 别名]
    def do_changes(self):
        uuid= OSConf.get_app_uuid(self.app_name)
        try:
            for i in range(5):
                cmd = "echo %s>> /var/lib/openshift/%s/%s/logs/error_log-*"%(self.text_to_verify, uuid, "".join([a for a in common.app_types[self.app_type] if a.isalpha()]))
                (status1, output) = common.run_remote_cmd(self.app_name, cmd)
                cmd = "echo %s>> /var/lib/openshift/%s/%s/logs/access_log-*"%(self.text_to_verify, uuid, "".join([a for a in common.app_types[self.app_type] if a.isalpha()]))
                (status2, output) = common.run_remote_cmd(self.app_name, cmd)
        except Exception as e:
            self.error(str(e))
            return 1

        return status1+status2
开发者ID:xiama,项目名称:automations,代码行数:15,代码来源:rhc_tail_files_check.py

示例13: cgsnapshot

# 需要导入模块: import OSConf [as 别名]
# 或者: from OSConf import get_app_uuid [as 别名]
 def cgsnapshot(self):
     uuid = OSConf.get_app_uuid(self.app_name)
     cmd="cgsnapshot -s | awk '/group libra\/%s/{yes=1} /^}/{if(yes==1) yes=0} {if(yes==1) print $0}'"%uuid
     (status, output) = common.run_remote_cmd_as_root(cmd)
     if status == 0:
         obj = re.search(r"memory.limit_in_bytes=\"536870912", output, re.MULTILINE)
         obj2 = re.search(r"memory.memsw.limit_in_bytes=\"641728512", output, re.MULTILINE)
         if obj and obj2:
             return 0
         else:
             print "ERROR: Unable to verify memory limits."
             return 1
     return 1
开发者ID:xiama,项目名称:automations,代码行数:15,代码来源:change_std_gear.py

示例14: run_remote_cmd2

# 需要导入模块: import OSConf [as 别名]
# 或者: from OSConf import get_app_uuid [as 别名]
def run_remote_cmd2(app_name, cmd, as_root=False, host=None, quiet=False):
    """
    Using ssh client
    """
    if as_root:
        user = 'root'
        if not host:
            host = get_instance_ip()
        key_filename = get_root_ssh_key()
    else:
        user = OSConf.get_app_uuid(app_name)
        if not host:
            host = OSConf.get_app_url(app_name)
        key_filename = get_default_ssh_key()
    return rcmd_get_status_output2(cmd, user, host, key_filename, quiet)
开发者ID:xiama,项目名称:automations,代码行数:17,代码来源:misc.py

示例15: run_remote_cmd

# 需要导入模块: import OSConf [as 别名]
# 或者: from OSConf import get_app_uuid [as 别名]
def run_remote_cmd(app_name, cmd, as_root=False, host=None, quiet=False):
    """Using paramiko client"""
    if as_root:
        user = 'root'
        if not host:
            #host = get_instance_ip()
            ssh_url = OSConf.get_ssh_url(app_name)
            host = os.popen('ssh %s hostname'%ssh_url).read().strip('\n')
        key_filename = get_root_ssh_key()
    else:
        user = OSConf.get_app_uuid(app_name)
        if not host:
            host = OSConf.get_app_url(app_name)
        key_filename = get_default_ssh_key()
    return rcmd_get_status_output(cmd, user, host, key_filename, quiet)
开发者ID:xiama,项目名称:automations,代码行数:17,代码来源:misc.py


注:本文中的OSConf.get_app_uuid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。