xiaoyu_utils.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:astoptool 作者: zouliuyun 项目源码 文件源码
def dns(self):
        """
        The dns for the game server. Will try to get only once and save to self._dns for later use.
        """
        def get_dns():
            cmd = '''grep server_name %s.conf | awk '{print $2}' | tr -d ";" ''' % self.name

            @hosts(self.int_ip)
            def _get_dns():
                with cd('/app/nginx/conf/vhost'.format(self.name)):
                    result = run(cmd)

                lines = result.splitlines()
                if len(lines) == 1:
                    return lines[0]
                else:
                    raise Exception("Can't get dns using cmd: {}".format(cmd))

            result = execute(_get_dns)
            return result[self.int_ip]

        if not self._dns:
            self._dns = get_dns()
        return self._dns
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号