Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NEXMANAGE-853] Remove ORAS and update method #569

Merged
merged 2 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion inbm/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).

## NEXT - MMMM-DD-YY

### Changed
- (NEXMANAGE-853) Remove ORAS and update method

## 4.2.6 - 2024-10-04
### Added
Expand Down
4 changes: 2 additions & 2 deletions inbm/dispatcher-agent/dispatcher/sota/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
# Tiber Update Tool file path
TIBER_UPDATE_TOOL_PATH = get_canonical_representation_of_path('/usr/bin/os-update-tool.sh')

# ORAS release server access token path
ORAS_TOKEN_PATH = get_canonical_representation_of_path('/etc/intel_edge_node/tokens/platform-update-agent/'
# Release server access token path
RELEASE_SERVER_TOKEN_PATH = get_canonical_representation_of_path('/etc/intel_edge_node/tokens/platform-update-agent/'
'rs_access_token')

SOTA_STATE = 'normal'
Expand Down
16 changes: 8 additions & 8 deletions inbm/dispatcher-agent/dispatcher/sota/downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from typing import Optional
from .mender_util import read_current_mender_version
from .sota_error import SotaError
from .oras_util import oras_download, read_oras_token
from .tiber_util import read_release_server_token, tiber_download
from ..constants import UMASK_OTA
from ..downloader import download
from ..packagemanager.irepo import IRepo
Expand Down Expand Up @@ -195,14 +195,14 @@ def download(self,
if uri is None:
raise SotaError("URI is None while performing TiberOS download")

password = read_oras_token()
password = read_release_server_token()

oras_download(dispatcher_broker=dispatcher_broker,
uri=uri,
repo=repo,
umask=UMASK_OTA,
username=username,
password=password)
tiber_download(dispatcher_broker=dispatcher_broker,
uri=uri,
repo=repo,
umask=UMASK_OTA,
username=username,
token=password)

def check_release_date(self, release_date: Optional[str]) -> bool:
raise NotImplementedError()
238 changes: 0 additions & 238 deletions inbm/dispatcher-agent/dispatcher/sota/oras_util.py

This file was deleted.

15 changes: 10 additions & 5 deletions inbm/dispatcher-agent/dispatcher/sota/os_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,20 @@ class SotaOsFactory:

def __init__(self, dispatcher_broker: DispatcherBroker,
sota_repos: Optional[str] = None, package_list: list[str] = [],
signature: Optional[str] = None) -> None:
signature: Optional[str] = None, uri: Optional[str] = None) -> None:
"""Initializes OsFactory.

@param dispatcher_broker: DispatcherBroker object used to communicate with other INBM services
@param sota_repos: new Ubuntu/Debian mirror (or None)
@param package_list: list of packages to install/update (or empty for all--general upgrade)
@param signature: signature used to verify image
@param uri: uri provided in the manifest
"""
self._sota_repos = sota_repos
self._package_list = package_list
self._dispatcher_broker = dispatcher_broker
self._signature = signature
self._uri = uri

@staticmethod
def verify_os_supported() -> str:
Expand Down Expand Up @@ -78,10 +80,10 @@ def get_os(self, os_type) -> "ISotaOs":
#TODO: Remove this when confirmed that TiberOS is in use
elif os_type == LinuxDistType.Mariner.name:
logger.debug("Mariner returned")
return TiberOSBasedSotaOs(self._dispatcher_broker, self._signature)
return TiberOSBasedSotaOs(self._dispatcher_broker, self._signature, self._uri)
elif os_type == LinuxDistType.tiber.name:
logger.debug("TiberOS returned")
return TiberOSBasedSotaOs(self._dispatcher_broker, self._signature)
return TiberOSBasedSotaOs(self._dispatcher_broker, self._signature, self._uri)
raise ValueError('Unsupported OS type: ' + os_type)


Expand Down Expand Up @@ -261,14 +263,17 @@ def create_downloader(self) -> Downloader:
class TiberOSBasedSotaOs(ISotaOs):
"""TiberOSBasedSotaOs class, child of ISotaOs"""

def __init__(self, dispatcher_broker: DispatcherBroker, signature: Optional[str] = None) -> None:
def __init__(self, dispatcher_broker: DispatcherBroker, signature: Optional[str] = None,
uri: Optional[str] = None) -> None:
"""Constructor.

@param dispatcher_broker: DispatcherBroker object used to communicate with other INBM services
@param signature: signature used to verify image
@param uri: uri provided in the manifest
"""
self._dispatcher_broker = dispatcher_broker
self._signature = signature
self._uri = uri

def create_setup_helper(self) -> SetupHelper:
logger.debug("")
Expand All @@ -280,7 +285,7 @@ def create_rebooter(self) -> Rebooter:

def create_os_updater(self) -> OsUpdater:
logger.debug("")
return TiberOSUpdater(signature=self._signature)
return TiberOSUpdater(signature=self._signature, uri=self._uri)

def create_snapshotter(self, sota_cmd: str, snap_num: Optional[str],
proceed_without_rollback: bool, reboot_device: bool) -> Snapshot:
Expand Down
Loading