本文整理汇总了Python中OSConf.get_git_url方法的典型用法代码示例。如果您正苦于以下问题:Python OSConf.get_git_url方法的具体用法?Python OSConf.get_git_url怎么用?Python OSConf.get_git_url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OSConf
的用法示例。
在下文中一共展示了OSConf.get_git_url方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: git_clone_app
# 需要导入模块: import OSConf [as 别名]
# 或者: from OSConf import get_git_url [as 别名]
def git_clone_app(app_name):
git_url = OSConf.get_git_url(app_name)
if not git_url:
pass
cmd = "git clone %s"% git_url
(status, output) = cmd_get_status_output(cmd)
return status
示例2: test_method
# 需要导入模块: import OSConf [as 别名]
# 或者: from OSConf import get_git_url [as 别名]
def test_method(self):
# Create app
ret = common.create_app(self.app_name, self.app_type, self.config.OPENSHIFT_user_email, self.config.OPENSHIFT_user_passwd)
self.assert_equal(ret, 0, "App creation failed")
# Add an public git repo as a submodule of the app
cmd = "cd %s && git submodule add %s" % (self.git_repo, self.submodule_repo)
(ret, output) = common.command_getstatusoutput(cmd)
self.debug(output)
self.assert_equal(ret, 0, "Failed to add submodule")
# Modify .openshift/action_hooks/pre_build
try:
f = file("%s/.openshift/action_hooks/pre_build" % (self.git_repo), "w")
f.write(GitSubmoduleTest.CODE)
f.close()
except IOError:
return self.failed("Failed to write code to %s/.openshift/action_hooks/pre_build" % (self.git_repo))
except:
self.error("Unknown error")
import traceback
traceback.print_exc()
return self.failed("%s failed" % self.__class__.__name__)
# Git push all the changes
cmd = "cd %s && git add . && git commit -amt && git push" % (self.git_repo)
###expected_output = "Test Result: PASS. git submodule update is executed successfully on server"
(ret, output) = common.command_getstatusoutput(cmd)
self.debug(output)
self.assert_equal(ret, 0, "Git push failed")
###if output.find(expected_output) == -1:
### return self.failed("%s failed" % self.__class__.__name__)
# Git clone the app's repo and pull down the submodule
cmd = "git clone %s %s-clone && cd %s-clone && git submodule init && git submodule update" % (OSConf.get_git_url(self.app_name), self.app_name, self.app_name)
(ret, output) = common.command_getstatusoutput(cmd)
self.debug(output)
self.assert_equal(ret, 0, "Failed to git clone the repo and pull down submodule")
# Check if the submodule is pulled down
self.info("Checking dir: %s-clone/%s" % (self.app_name, self.submodule_name))
try:
lst = os.listdir("%s-clone/%s" % (self.app_name, self.submodule_name))
except OSError:
return self.failed("Failed to list files under %s-clone/%s. The dir may not exist" % (self.git_repo, self.submodule_name))
except:
self.error("Unknown error")
import traceback
traceback.print_exc()
return self.failed("%s failed" % self.__class__.__name__)
if len(lst) == 0:
return self.failed("The git submodule isn't pulled down")
else:
self.info("The git submodule is successfully pulled down")
return self.passed("%s passed" % self.__class__.__name__)