summaryrefslogtreecommitdiffstats
path: root/eos_downloader
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-08 08:23:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-08 08:23:39 +0000
commitfce0b7f16de0c9fb29edcb923b63cd3b6db05f91 (patch)
tree915d54fc6a6353ffb324b7fd19e8c2e70a341857 /eos_downloader
parentReleasing debian version 0.9.0-1. (diff)
downloadeos-downloader-fce0b7f16de0c9fb29edcb923b63cd3b6db05f91.tar.xz
eos-downloader-fce0b7f16de0c9fb29edcb923b63cd3b6db05f91.zip
Merging upstream version 0.10.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'eos_downloader')
-rw-r--r--eos_downloader/cli/get/commands.py4
-rw-r--r--eos_downloader/eos.py3
-rw-r--r--eos_downloader/object_downloader.py7
3 files changed, 10 insertions, 4 deletions
diff --git a/eos_downloader/cli/get/commands.py b/eos_downloader/cli/get/commands.py
index b4525fe..498473a 100644
--- a/eos_downloader/cli/get/commands.py
+++ b/eos_downloader/cli/get/commands.py
@@ -128,6 +128,7 @@ def eos(
console = Console()
# Get from Context
token = ctx.obj["token"]
+ is_latest: bool = False
if token is None or token == "":
console.print(
"❗ Token is unset ! Please configure ARISTA_TOKEN or use --token option",
@@ -156,6 +157,7 @@ def eos(
my_download.authenticate()
elif latest:
+ is_latest = True
my_download = eos_downloader.eos.EOSDownloader(
image=image_type,
software="EOS",
@@ -180,7 +182,7 @@ def eos(
my_download.download_local(file_path=output, checksum=True)
if import_docker:
- my_download.docker_import(image_name=docker_name)
+ my_download.docker_import(image_name=docker_name, is_latest=is_latest)
console.print("✅ processing done !")
sys.exit(0)
diff --git a/eos_downloader/eos.py b/eos_downloader/eos.py
index 716992f..ada0eb6 100644
--- a/eos_downloader/eos.py
+++ b/eos_downloader/eos.py
@@ -137,8 +137,7 @@ class EOSDownloader(ObjectDownloader):
selected_branch = EosVersion.from_str(BASE_BRANCH_STR)
for branch in self._get_branches(with_rtype=rtype):
branch = EosVersion.from_str(branch)
- if branch > selected_branch:
- selected_branch = branch
+ selected_branch = max(selected_branch, branch)
return selected_branch
def get_eos_versions(
diff --git a/eos_downloader/object_downloader.py b/eos_downloader/object_downloader.py
index d7b1418..30cf9df 100644
--- a/eos_downloader/object_downloader.py
+++ b/eos_downloader/object_downloader.py
@@ -547,7 +547,9 @@ class ObjectDownloader:
if noztp:
self._disable_ztp(file_path=file_path)
- def docker_import(self, image_name: str = "arista/ceos") -> None:
+ def docker_import(
+ self, image_name: str = "arista/ceos", is_latest: bool = False
+ ) -> None:
"""
Import docker container to your docker server.
@@ -561,6 +563,9 @@ class ObjectDownloader:
logger.info(f"Importing image {self.filename} to {docker_image}")
console.print(f"🚀 Importing image {self.filename} to {docker_image}")
os.system(f"$(which docker) import {self.filename} {docker_image}")
+ if is_latest:
+ console.print(f"🚀 Configuring {docker_image}:{self.version} to be latest")
+ os.system(f"$(which docker) tag {docker_image} {image_name}:latest")
for filename in glob.glob(f"{self.filename}*"):
try:
os.remove(filename)