From 17b57f10c03a792aebc9e01ba67bdeca364a91bd Mon Sep 17 00:00:00 2001 From: Samuele Chiocca Date: Fri, 10 Jan 2020 23:40:40 +0100 Subject: [PATCH] Fixed kubectl install #1 --- commands/install.py | 17 ++--------------- commands/list.py | 2 +- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/commands/install.py b/commands/install.py index 55d6455..a16c266 100644 --- a/commands/install.py +++ b/commands/install.py @@ -22,10 +22,9 @@ def download_program(args, program, version): \nYou can check right available versions by running 'kubenvz kubectl/kustomize list remote'.\ \nFor more informaion, Please refer kubenvz document https://github.com/aaratn/kubenvz#kubenvz-kubectlkustomize-list-remote.\n") sys.exit(1) - +# if program == "kubectl": - url = "https://github.com/kubernetes/kubectl/releases/download/v" + \ - version + "/kustomize_" + operating_sys + "_amd64" + url = "https://storage.googleapis.com/kubernetes-release/release/v"+version+"/bin/"+operating_sys+"/amd64/kubectl" elif program == "kustomize": url = "https://github.com/kubernetes-sigs/kustomize/releases/download/v" + \ @@ -44,18 +43,6 @@ def download_program(args, program, version): open(dest_path, 'wb').write(binary.content) - if program == "kubectl": - - with ZipFile(dest_path, 'r') as zip: - zip.extract('kubectl', path=DOWNLOAD_PATH) - - if os.path.exists(DOWNLOAD_PATH + '/' + program) and os.path.exists(dest_path): - os.remove(dest_path) - os.rename(DOWNLOAD_PATH + '/' + program, dest_path) - - else: - raise Exception("Issue extracting kubectl !!") - os.chmod(dest_path, 0o755) else: print (program, version, "already downloaded") diff --git a/commands/list.py b/commands/list.py index b529652..aacd78e 100644 --- a/commands/list.py +++ b/commands/list.py @@ -38,7 +38,7 @@ def list_remote(args): available_versions = [''] for version in parsed_json: - available_versions.append(version['name'].lstrip('v')) + available_versions.append(version['name'].lstrip('v').lstrip('kubernetes-')) available_versions.remove('') # available_versions.sort(key=StrictVersion)