Fix wget renaming issue on SuSE

This commit is contained in:
Yue Zhang 2015-09-06 18:25:21 +08:00
Родитель 0338487297
Коммит ae48608154
2 изменённых файлов: 22 добавлений и 13 удалений

Просмотреть файл

@ -128,27 +128,32 @@ def coreos_package_install():
def install_ez_setup():
RunLog.info ("Installing ez_setup.py...")
DownloadUrl(tar_link.get("ez_setup.py"), "/tmp/")
ez_setup = os.path.join("/tmp", "ez_setup.py")
DownloadUrl(tar_link.get("ez_setup.py"), "/tmp/", output_file=ez_setup)
if not os.path.isfile(ez_setup):
RunLog.error("Installing ez_setup.py...[failed]")
RunLog.error("File not found: {0}".format(ez_setup))
return False
Run("{0} {1}".format(python_cmd, ez_setup))
def install_waagent_from_github():
RunLog.info ("Installing waagent from github...")
DownloadUrl(tar_link.get("waagent"), "/tmp/")
filename = tar_link.get("waagent").split('/')[-1]
RunLog.info ("Waagent tar file name is: "+ filename+"|")
pkgPath = os.path.join("/tmp", filename)
unzipPath = os.path.join("/tmp", "agent")
if os.path.isdir(unzipPath):
shutil.rmtree(unzipPath)
pkgPath = os.path.join("/tmp", "agent.zip")
DownloadUrl(tar_link.get("waagent"), "/tmp/", output_file=pkgPath)
if not os.path.isfile(pkgPath):
RunLog.error("Installing waagent from github...[failed]")
RunLog.error("File not found: {0}".format(pkgPath))
return False
unzipPath = os.path.join("/tmp", "agent")
if os.path.isdir(unzipPath):
shutil.rmtree(unzipPath)
try:
zipfile.ZipFile(pkgPath).extractall(unzipPath)
except IOError as e:

Просмотреть файл

@ -55,12 +55,16 @@ def UpdateRepos(current_distro):
RunLog.info ("Updating the repositoriy information... [done]")
return True
def DownloadUrl(url, destination_folder):
rtrn = Run("wget -P "+destination_folder+" "+url+ " 2>&1")
def DownloadUrl(url, destination_folder, output_file=None):
cmd = "wget -P "+destination_folder+" "+url+ " 2>&1"
if output_file is not None:
cmd = "wget {0} -O {1} 2>&1".format(url, output_file)
rtrn = Run(cmd)
if(rtrn.rfind("wget: command not found") != -1):
install_package("wget")
rtrn = Run("wget -P "+destination_folder+" "+url+ " 2>&1")
InstallPackage("wget")
rtrn = Run(cmd)
if( rtrn.rfind("100%") != -1):
return True