From 31444ebea88bbb66a22910cbb265e7d18c54dddd Mon Sep 17 00:00:00 2001 From: Natalie Gaston Date: Fri, 5 Jan 2024 14:22:40 -0800 Subject: [PATCH 01/14] Implement using deb822 format in source application add command --- docs/Manifest Parameters.md | 34 +++++--- inbc-program/README.md | 21 ++++- inbc-program/inbc/parser/parser.py | 6 +- inbc-program/inbc/parser/source_app_parser.py | 35 +++++--- .../tests/unit/test_source_app_parser.py | 80 ++++++++++++++++++- .../dispatcher-agent/manifest_schema.xsd | 4 +- 6 files changed, 144 insertions(+), 36 deletions(-) diff --git a/docs/Manifest Parameters.md b/docs/Manifest Parameters.md index 266a689f1..6dca55728 100644 --- a/docs/Manifest Parameters.md +++ b/docs/Manifest Parameters.md @@ -918,10 +918,10 @@ The query command can be used to gather information about the system and the Vis | `` | `source` | R | | | `` | `` | R | | | `` | `` | R | | -| `` | `` | R | | -| `` | `https://dl-ssl.google.com/linux/linux_signing_key.pub` | R | | -| `` | `google-chrome.gpg` | R | | -| `` | `` | R | | +| `` | `` | O | | +| `` | `https://dl-ssl.google.com/linux/linux_signing_key.pub` | O | | +| `` | `google-chrome.gpg` | O | | +| `` | `` | O | | | `` | `` | R | | | `` | `` | R | | | `` | `deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main` | R | | @@ -935,7 +935,7 @@ The query command can be used to gather information about the system and the Vis -#### Source application add Manifest Example +#### Source Application Add Manifest Example using remote GPG key ```xml @@ -966,7 +966,6 @@ The query command can be used to gather information about the system and the Vis | `` | `source` | R | | | `` | `` | R | | | `` | `` | R | | -| `` | `` | R | | | `` | `` | R | | | `` | `` | R | | | `` | `deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main` | R | | @@ -1006,9 +1005,9 @@ The query command can be used to gather information about the system and the Vis | `` | `source` | R | | | `` | `` | R | | | `` | `` | R | | -| `` | `` | R | | -| `` | `google-chrome.gpg` | R | | -| `` | `` | R | | +| `` | `` | O | | +| `` | `google-chrome.gpg` | O | | +| `` | `` | O | | | `` | `` | R | | | `` | `google-chrom.list` | R | | | `` | `` | R | | @@ -1019,7 +1018,7 @@ The query command can be used to gather information about the system and the Vis -#### Source Application Remove Manifest Example +#### Source Application Remove Manifest Example (Including GPG key) ```xml @@ -1037,6 +1036,21 @@ The query command can be used to gather information about the system and the Vis ``` +#### Source Application Remove Manifest Example (Excluding GPG key) +```xml + + + source + + + + google-chrome.list + + + + +``` + #### Source Application List Manifest Parameters | Tag | Example | Required/Optional | Notes | |:-----------------------------------------|:-----------------------------------------|:-----------------:|:------| diff --git a/inbc-program/README.md b/inbc-program/README.md index 4737645c6..3219dd569 100644 --- a/inbc-program/README.md +++ b/inbc-program/README.md @@ -427,7 +427,7 @@ inbc source application add ``` ### Example -#### Add an application source +#### Add an Application Source (with remote GPG key) ``` inbc source application add --gpgKeyUri https://dl-ssl.google.com/linux/linux_signing_key.pub @@ -436,25 +436,38 @@ inbc source application add --filename google-chrome.list ``` +#### Add an Application Source (using deb822 format) +``` +inbc source application add + --sources "Types: deb\nURIs: https://files.internal.ledgepark.intel.com\nSuites: ledgepark\nComponents: release\nSigned-By:\n-----BEGIN PGP PUBLIC KEY BLOCK-----\n.\nthegibberishasciikeydatagoesherethegibberishasciikeydatagoeshere\nthegibberishasciikeydatagoesherethegibberishasciikeydatagoeshere\nthegibberishasciikeydatagoesherethegibberishasciikeydatagoeshere=/Xiv\n-----END PGP PUBLIC KEY BLOCK-----\n" + --filename google-chrome.list +``` + ## SOURCE APPLICATION REMOVE ### Description -Removes the GPG key file from under /usr/share/keyrings. Removes the source file from under /etc/apt/sources.list.d/. +Removes the source file from under /etc/apt/sources.list.d/. Optionally removes the GPG key file from under /usr/share/keyrings. ### Usage ``` inbc source application remove - {--gpgKeyName, -gkn=GPG_KEY_NAME} + [--gpgKeyName, -gkn=GPG_KEY_NAME] {--filename, -f=FILE_NAME} ``` ### Example -#### Remove an application source +#### Remove an application source (Both GPG key and File) ```commandline inbc source application remove --gpgKeyName google-chrome.gpg --filename google-chrome.list ``` +#### Remove an application source (File only) +```commandline +inbc source application remove + --filename google-chrome.list +``` + ## SOURCE APPLICATION UPDATE ### Description Updates Application sources that are used to update the system diff --git a/inbc-program/inbc/parser/parser.py b/inbc-program/inbc/parser/parser.py index 97201444b..3f3208d50 100644 --- a/inbc-program/inbc/parser/parser.py +++ b/inbc-program/inbc/parser/parser.py @@ -65,11 +65,11 @@ def parse_source_args(self) -> None: # Application Add Command app_add_parser = app_subparsers.add_parser('add') - app_add_parser.add_argument('--gpgKeyUri', '-gku', required=True, + app_add_parser.add_argument('--gpgKeyUri', '-gku', required=False, type=lambda x: validate_string_less_than_n_characters( x, 'str', 1500), help='Uri from which to download GPG key') - app_add_parser.add_argument('--gpgKeyName', '-gkn', required=True, + app_add_parser.add_argument('--gpgKeyName', '-gkn', required=False, type=lambda x: validate_string_less_than_n_characters( x, 'str', 200), help='Name to store the GPG key information') @@ -85,7 +85,7 @@ def parse_source_args(self) -> None: # Application Remove Command app_remove_parser = app_subparsers.add_parser('remove') - app_remove_parser.add_argument('--gpgKeyName', '-gkn', required=True, + app_remove_parser.add_argument('--gpgKeyName', '-gkn', required=False, type=lambda x: validate_string_less_than_n_characters( x, 'str', 50), help='GPG key name of the source to remove.') diff --git a/inbc-program/inbc/parser/source_app_parser.py b/inbc-program/inbc/parser/source_app_parser.py index 680dd4615..99ccfab7a 100644 --- a/inbc-program/inbc/parser/source_app_parser.py +++ b/inbc-program/inbc/parser/source_app_parser.py @@ -5,10 +5,15 @@ """ import argparse +from ..inbc_exception import InbcException from ..xml_tag import create_xml_tag def application_add(args: argparse.Namespace) -> str: + if (args.gpgKeyUri and args.gpgKeyName is None) or (args.gpgKeyName and args.gpgKeyUri is None): + raise InbcException( + "Source requires either both gpgKeyUri and gpgKeyName to be provided, or neither of them.") + arguments = { 'uri': args.gpgKeyUri, 'keyname': args.gpgKeyName, @@ -19,12 +24,13 @@ def application_add(args: argparse.Namespace) -> str: manifest = ('' + '' + 'source' + - '' + - '' - '{0}' + - '{1}' - '').format(create_xml_tag(arguments, "uri"), - create_xml_tag(arguments, "keyname")) + '' + '') + + if args.gpgKeyUri and args.gpgKeyName: + manifest += ('' + '{0}' + '{1}' + '').format(create_xml_tag(arguments, "uri"), + create_xml_tag(arguments, "keyname")) + + manifest += '' for source in args.sources: manifest += '' + source.strip() + '' @@ -47,13 +53,16 @@ def application_remove(args: argparse.Namespace) -> str: manifest = ('' + 'source' + '' + - '' - f'{create_xml_tag(arguments, "keyname")}' + - '' + - f'{create_xml_tag(arguments, "filename")}' - '' - '' + - '') + '') + + if args.gpgKeyName: + manifest += f'{create_xml_tag(arguments, "keyname")}' + + manifest += ('' + + f'{create_xml_tag(arguments, "filename")}' + '' + '' + + '') print(f"manifest {manifest}") return manifest diff --git a/inbc-program/tests/unit/test_source_app_parser.py b/inbc-program/tests/unit/test_source_app_parser.py index 43cfbaeb8..5d74e5553 100644 --- a/inbc-program/tests/unit/test_source_app_parser.py +++ b/inbc-program/tests/unit/test_source_app_parser.py @@ -1,8 +1,10 @@ +import pytest from unittest import TestCase from unittest.mock import patch from inbc.inbc import Inbc from inbc.parser.parser import ArgsParser +from inbc.inbc_exception import InbcException class TestSourceApplicationParser(TestCase): @@ -10,7 +12,7 @@ def setUp(self): self.arg_parser = ArgsParser() self.maxDiff = None - def test_parse_add_arguments_successfully(self): + def test_parse_add_all_arguments_successfully(self): f = self.arg_parser.parse_args( ['source', 'application', 'add', '--gpgKeyUri', 'https://repositories.intel.com/gpu/intel-graphics.key', @@ -24,8 +26,46 @@ def test_parse_add_arguments_successfully(self): 'deb-src http://example.com/ focal-security main']) self.assertEqual(f.filename, 'intel-gpu-jammy.list') + def test_parse_add_arguments_without_gpg_successfully(self): + f = self.arg_parser.parse_args( + ['source', 'application', 'add', + '--sources', 'deb http://example.com/ focal main restricted universe', + 'deb-src http://example.com/ focal-security main', + '--filename', 'intel-gpu-jammy.list']) + self.assertEqual(f.gpgKeyUri, None) + self.assertEqual(f.gpgKeyName, None) + self.assertEqual(f.sources, ['deb http://example.com/ focal main restricted universe', + 'deb-src http://example.com/ focal-security main']) + self.assertEqual(f.filename, 'intel-gpu-jammy.list') + + @patch('inbm_lib.mqttclient.mqtt.mqtt.Client.connect') + def test_raise_application_add_with_only_one_gpgKeyUri_param(self, m_connect): + p = self.arg_parser.parse_args( + ['source', 'application', 'add', + '--gpgKeyUri', 'https://repositories.intel.com/gpu/intel-graphics.key', + '--sources', 'deb http://example.com/ focal main restricted universe', + 'deb-src http://example.com/ focal-security main', + '--filename', 'intel-gpu-jammy.list']) + with pytest.raises(InbcException, + match="Source requires either both gpgKeyUri and gpgKeyName " + "to be provided, or neither of them."): + Inbc(p, 'source', False) + @patch('inbm_lib.mqttclient.mqtt.mqtt.Client.connect') - def test_create_add_manifest_successfully(self, m_connect): + def test_raise_application_add_with_only_one_gpgKeyName_param(self, m_connect): + p = self.arg_parser.parse_args( + ['source', 'application', 'add', + '--gpgKeyName', 'intel-graphics.gpg', + '--sources', 'deb http://example.com/ focal main restricted universe', + 'deb-src http://example.com/ focal-security main', + '--filename', 'intel-gpu-jammy.list']) + with pytest.raises(InbcException, + match="Source requires either both gpgKeyUri and gpgKeyName " + "to be provided, or neither of them."): + Inbc(p, 'source', False) + + @patch('inbm_lib.mqttclient.mqtt.mqtt.Client.connect') + def test_create_add_all_param_manifest_successfully(self, m_connect): p = self.arg_parser.parse_args( ['source', 'application', 'add', '--gpgKeyUri', 'https://repositories.intel.com/gpu/intel-graphics.key', @@ -42,7 +82,22 @@ def test_create_add_manifest_successfully(self, m_connect): 'intel-gpu-jammy.list' self.assertEqual(p.func(p), expected) - def test_parse_remove_arguments_successfully(self): + @patch('inbm_lib.mqttclient.mqtt.mqtt.Client.connect') + def test_create_add_minus_gpg_manifest_successfully(self, m_connect): + p = self.arg_parser.parse_args( + ['source', 'application', 'add', + '--sources', 'deb http://example.com/ focal main restricted universe', + 'deb-src http://example.com/ focal-security main', + '--filename', 'intel-gpu-jammy.list']) + Inbc(p, 'source', False) + expected = 'source' \ + '' \ + 'deb http://example.com/ focal main restricted universe' \ + 'deb-src http://example.com/ focal-security main' \ + 'intel-gpu-jammy.list' + self.assertEqual(p.func(p), expected) + + def test_parse_all_remove_arguments_successfully(self): f = self.arg_parser.parse_args( ['source', 'application', 'remove', '--gpgKeyName', 'intel-gpu-jammy.gpg', @@ -50,8 +105,15 @@ def test_parse_remove_arguments_successfully(self): self.assertEqual(f.gpgKeyName, 'intel-gpu-jammy.gpg') self.assertEqual(f.filename, 'intel-gpu-jammy.list') + def test_parse_minus_gpg_remove_arguments_successfully(self): + f = self.arg_parser.parse_args( + ['source', 'application', 'remove', + '--filename', 'intel-gpu-jammy.list']) + self.assertEqual(f.gpgKeyName, None) + self.assertEqual(f.filename, 'intel-gpu-jammy.list') + @patch('inbm_lib.mqttclient.mqtt.mqtt.Client.connect') - def test_create_remove_manifest_successfully(self, m_connect): + def test_create_remove_manifest_all_params_successfully(self, m_connect): p = self.arg_parser.parse_args( ['source', 'application', 'remove', '--gpgKeyName', 'intel-gpu-jammy.gpg', @@ -62,6 +124,16 @@ def test_create_remove_manifest_successfully(self, m_connect): 'intel-gpu-jammy.list' self.assertEqual(p.func(p), expected) + @patch('inbm_lib.mqttclient.mqtt.mqtt.Client.connect') + def test_create_remove_manifest_minus_gpg_successfully(self, m_connect): + p = self.arg_parser.parse_args( + ['source', 'application', 'remove', + '--filename', 'intel-gpu-jammy.list']) + Inbc(p, 'source', False) + expected = 'source' \ + 'intel-gpu-jammy.list' + self.assertEqual(p.func(p), expected) + def test_parse_update_arguments_successfully(self): f = self.arg_parser.parse_args( ['source', 'application', 'update', diff --git a/inbm/dispatcher-agent/fpm-template/usr/share/dispatcher-agent/manifest_schema.xsd b/inbm/dispatcher-agent/fpm-template/usr/share/dispatcher-agent/manifest_schema.xsd index 6a8fad59b..91964c256 100644 --- a/inbm/dispatcher-agent/fpm-template/usr/share/dispatcher-agent/manifest_schema.xsd +++ b/inbm/dispatcher-agent/fpm-template/usr/share/dispatcher-agent/manifest_schema.xsd @@ -319,7 +319,7 @@ - + @@ -367,7 +367,7 @@ - + From df1d12b9cb2d62d7142741934ce5c8793e7c8782 Mon Sep 17 00:00:00 2001 From: Natalie Gaston Date: Mon, 8 Jan 2024 12:35:05 -0800 Subject: [PATCH 02/14] Dispatcher changes --- inbc-program/README.md | 18 ++++----- .../dispatcher/source/constants.py | 7 ++-- .../dispatcher/source/source_command.py | 5 +-- .../source/ubuntu_source_manager.py | 15 +++++--- .../unit/source/test_ubuntu_source_cmd.py | 37 +++++++++++++++++-- 5 files changed, 58 insertions(+), 24 deletions(-) diff --git a/inbc-program/README.md b/inbc-program/README.md index 3219dd569..5911f1ec7 100644 --- a/inbc-program/README.md +++ b/inbc-program/README.md @@ -414,16 +414,16 @@ inbc query --option sw ## SOURCE APPLICATION ADD ### Description -Downloads and encrypts GPG key and stores it on the system under /usr/share/keyrings. Creates a file under /etc/apt/sources.list.d to store the update source information. -This list file is used during 'sudo apt update' to update the application +Optionally Downloads and encrypts GPG key and stores it on the system under /usr/share/keyrings. Creates a file under /etc/apt/sources.list.d to store the update source information. +This list file is used during 'sudo apt update' to update the application. Deb882 format may be used instead of downloading a GPG key. ### Usage ``` -inbc source application add - {--gpgKeyUri, -gku=GPG_KEY_URI} - {--gpgKeyName, -gkn=GPG_KEY_NAME} +inbc source application add {--sources, -s=SOURCES} {--filename, -f=FILENAME} + [--gpgKeyUri, -gku=GPG_KEY_URI] + [--gpgKeyName, -gkn=GPG_KEY_NAME] ``` ### Example @@ -449,20 +449,20 @@ Removes the source file from under /etc/apt/sources.list.d/. Optionally removes ### Usage ``` -inbc source application remove - [--gpgKeyName, -gkn=GPG_KEY_NAME] +inbc source application remove {--filename, -f=FILE_NAME} + [--gpgKeyName, -gkn=GPG_KEY_NAME] ``` ### Example -#### Remove an application source (Both GPG key and File) +#### Remove an application source (Both GPG key and Source File) ```commandline inbc source application remove --gpgKeyName google-chrome.gpg --filename google-chrome.list ``` -#### Remove an application source (File only) +#### Remove an application source (Source File only) ```commandline inbc source application remove --filename google-chrome.list diff --git a/inbm/dispatcher-agent/dispatcher/source/constants.py b/inbm/dispatcher-agent/dispatcher/source/constants.py index 3d7d3f94c..908aab9cb 100644 --- a/inbm/dispatcher-agent/dispatcher/source/constants.py +++ b/inbm/dispatcher-agent/dispatcher/source/constants.py @@ -6,6 +6,7 @@ from enum import Enum, unique from dataclasses import dataclass, field +from typing import Optional UBUNTU_APT_SOURCES_LIST = "/etc/apt/sources.list" UBUNTU_APT_SOURCES_LIST_D = "/etc/apt/sources.list.d" @@ -25,16 +26,16 @@ class SourceParameters: @dataclass(kw_only=True, frozen=True) class ApplicationAddSourceParameters: - gpg_key_uri: str - gpg_key_name: str file_name: str sources: list[str] = field(default_factory=lambda: []) + gpg_key_uri: Optional[str] = field(default=None) + gpg_key_name: Optional[str] = field(default=None) @dataclass(kw_only=True, frozen=True) class ApplicationRemoveSourceParameters: - gpg_key_name: str file_name: str + gpg_key_name: Optional[str] = field(default=None) @dataclass(kw_only=True, frozen=True) diff --git a/inbm/dispatcher-agent/dispatcher/source/source_command.py b/inbm/dispatcher-agent/dispatcher/source/source_command.py index 2f90e0e7e..14280e228 100644 --- a/inbm/dispatcher-agent/dispatcher/source/source_command.py +++ b/inbm/dispatcher-agent/dispatcher/source/source_command.py @@ -54,7 +54,7 @@ def _handle_os_source_command(parsed_head: XmlHandler, os_type: OsType, os_actio Handle the os source commands. @param parsed_head: XmlHandler with command information - @param os_type: os type + @param os_type: OS type @param os_action: The action to be performed @return Result """ @@ -94,8 +94,7 @@ def _handle_os_source_command(parsed_head: XmlHandler, os_type: OsType, os_actio def _handle_app_source_command( - parsed_head: XmlHandler, os_type: OsType, app_action: dict -) -> Result: + parsed_head: XmlHandler, os_type: OsType, app_action: dict) -> Result: """ Handle the application source commands. diff --git a/inbm/dispatcher-agent/dispatcher/source/ubuntu_source_manager.py b/inbm/dispatcher-agent/dispatcher/source/ubuntu_source_manager.py index 220b8be3f..8838ff58a 100644 --- a/inbm/dispatcher-agent/dispatcher/source/ubuntu_source_manager.py +++ b/inbm/dispatcher-agent/dispatcher/source/ubuntu_source_manager.py @@ -23,7 +23,6 @@ from inbm_common_lib.utility import ( get_canonical_representation_of_path, remove_file, - move_file, create_file_with_contents, ) @@ -98,8 +97,10 @@ def __init__(self) -> None: pass def add(self, parameters: ApplicationAddSourceParameters) -> None: - # Step 1: Add key - add_gpg_key(parameters.gpg_key_uri, parameters.gpg_key_name) + """Adds a source file and optional GPG key to be used during Ubuntu application updates.""" + # Step 1: Add key (Optional) + if parameters.gpg_key_name and parameters.gpg_key_uri: + add_gpg_key(parameters.gpg_key_uri, parameters.gpg_key_name) # Step 2: Add the source try: @@ -134,11 +135,13 @@ def list(self) -> list[ApplicationSourceList]: raise SourceError(f"Error listing application sources: {e}") from e def remove(self, parameters: ApplicationRemoveSourceParameters) -> None: - """Removes a source file from the Ubuntu source file list under /etc/apt/sources.list.d + """Removes a source file from the Ubuntu source file list under /etc/apt/sources.list.d. Optionally + removes the gpg key from /usr/share/keyrings @parameters: dataclass parameters for ApplicationRemoveSourceParameters """ - # Remove the GPG key - remove_gpg_key_if_exists(parameters.gpg_key_name) + if parameters.gpg_key_name: + # Remove the GPG key (Optional) + remove_gpg_key_if_exists(parameters.gpg_key_name) # Remove the file under /etc/apt/sources.list.d try: diff --git a/inbm/dispatcher-agent/tests/unit/source/test_ubuntu_source_cmd.py b/inbm/dispatcher-agent/tests/unit/source/test_ubuntu_source_cmd.py index 9206154f9..fa28331b3 100644 --- a/inbm/dispatcher-agent/tests/unit/source/test_ubuntu_source_cmd.py +++ b/inbm/dispatcher-agent/tests/unit/source/test_ubuntu_source_cmd.py @@ -8,6 +8,7 @@ ApplicationRemoveSourceParameters, SourceParameters, ApplicationUpdateSourceParameters, + ApplicationAddSourceParameters ) from dispatcher.source.ubuntu_source_manager import ( UbuntuApplicationSourceManager, @@ -192,14 +193,44 @@ def test_update_sources_os_error(self): class TestUbuntuApplicationSourceManager: - @patch("dispatcher.source.ubuntu_source_manager.move_file") - def test_update_app_source_successfully(self, mock_move): + def test_add_app_with_gpg_key_successfully(self): + try: + params = ApplicationAddSourceParameters( + file_name="intel-gpu-jammy.list", + sources="deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main", + gpg_key_uri="https://dl-ssl.google.com/linux/linux_signing_key.pub", + gpg_key_name="google-chrome.gpg" + ) + command = UbuntuApplicationSourceManager() + with patch("builtins.open", new_callable=mock_open()): + command.add(params) + except SourceError as err: + assert False, f"'UbuntuApplicationSourceManager.add' raised an exception {err}" + + def test_add_app_deb_822_format_successfully(self): + try: + params = ApplicationAddSourceParameters( + file_name="intel-gpu-jammy.list", + sources="X-Repolib-Name: Google Chrome" + "Enabled: yes" + "Types:deb" + "URIs: https://dl-ssl.google.com/linux/linux_signing_key.pub" + "Suites: stable" + "Components: main", + ) + command = UbuntuApplicationSourceManager() + with patch("builtins.open", new_callable=mock_open()): + command.add(params) + except SourceError as err: + assert False, f"'UbuntuApplicationSourceManager.add' raised an exception {err}" + + def test_update_app_source_successfully(self): try: params = ApplicationUpdateSourceParameters( file_name="intel-gpu-jammy.list", sources=APP_SOURCE ) command = UbuntuApplicationSourceManager() - with patch("builtins.open", new_callable=mock_open()) as m: + with patch("builtins.open", new_callable=mock_open()): command.update(params) except SourceError as err: assert False, f"'UbuntuApplicationSourceManager.update' raised an exception {err}" From ac16c7a8ef79f3f85cb29f88de9489471a2da480 Mon Sep 17 00:00:00 2001 From: Natalie Gaston Date: Mon, 8 Jan 2024 17:17:29 -0800 Subject: [PATCH 03/14] Add deb822 format to source application add command --- inbc-program/README.md | 4 +- inbc-program/inbc/parser/source_app_parser.py | 3 ++ .../tests/unit/test_source_app_parser.py | 40 ++++++++++++++++--- .../dispatcher/source/source_command.py | 12 +++++- .../dispatcher-agent/manifest_schema.xsd | 10 ++--- .../unit/source/test_ubuntu_source_cmd.py | 2 +- 6 files changed, 56 insertions(+), 15 deletions(-) diff --git a/inbc-program/README.md b/inbc-program/README.md index 5911f1ec7..35a02ede9 100644 --- a/inbc-program/README.md +++ b/inbc-program/README.md @@ -439,8 +439,8 @@ inbc source application add #### Add an Application Source (using deb822 format) ``` inbc source application add - --sources "Types: deb\nURIs: https://files.internal.ledgepark.intel.com\nSuites: ledgepark\nComponents: release\nSigned-By:\n-----BEGIN PGP PUBLIC KEY BLOCK-----\n.\nthegibberishasciikeydatagoesherethegibberishasciikeydatagoeshere\nthegibberishasciikeydatagoesherethegibberishasciikeydatagoeshere\nthegibberishasciikeydatagoesherethegibberishasciikeydatagoeshere=/Xiv\n-----END PGP PUBLIC KEY BLOCK-----\n" - --filename google-chrome.list + --sources "X-Repolib-Name: Google Chrome" "Enabled: yes" "Types: deb" "URIs: https://dl-ssl.google.com/linux/linux_signing_key.pub" "Suites: stable" "Components: main" + --filename google-chrome.sources ``` ## SOURCE APPLICATION REMOVE diff --git a/inbc-program/inbc/parser/source_app_parser.py b/inbc-program/inbc/parser/source_app_parser.py index 99ccfab7a..89180e574 100644 --- a/inbc-program/inbc/parser/source_app_parser.py +++ b/inbc-program/inbc/parser/source_app_parser.py @@ -4,10 +4,13 @@ SPDX-License-Identifier: Apache-2.0 """ import argparse +import logging from ..inbc_exception import InbcException from ..xml_tag import create_xml_tag +logger = logging.getLogger(__name__) + def application_add(args: argparse.Namespace) -> str: if (args.gpgKeyUri and args.gpgKeyName is None) or (args.gpgKeyName and args.gpgKeyUri is None): diff --git a/inbc-program/tests/unit/test_source_app_parser.py b/inbc-program/tests/unit/test_source_app_parser.py index 5d74e5553..547f2f1d7 100644 --- a/inbc-program/tests/unit/test_source_app_parser.py +++ b/inbc-program/tests/unit/test_source_app_parser.py @@ -26,16 +26,24 @@ def test_parse_add_all_arguments_successfully(self): 'deb-src http://example.com/ focal-security main']) self.assertEqual(f.filename, 'intel-gpu-jammy.list') - def test_parse_add_arguments_without_gpg_successfully(self): + def test_parse_add_arguments_deb822_format_separate_lines_successfully(self): f = self.arg_parser.parse_args( ['source', 'application', 'add', - '--sources', 'deb http://example.com/ focal main restricted universe', - 'deb-src http://example.com/ focal-security main', + '--sources', 'X-Repolib-Name: Google Chrome', + 'Enabled: yes', + 'Types: deb', + 'URIs: https://dl-ssl.google.com/linux/linux_signing_key.pub', + 'Suites: stable', + 'Components: main', '--filename', 'intel-gpu-jammy.list']) self.assertEqual(f.gpgKeyUri, None) self.assertEqual(f.gpgKeyName, None) - self.assertEqual(f.sources, ['deb http://example.com/ focal main restricted universe', - 'deb-src http://example.com/ focal-security main']) + self.assertEqual(f.sources, ['X-Repolib-Name: Google Chrome', + 'Enabled: yes', + 'Types: deb', + 'URIs: https://dl-ssl.google.com/linux/linux_signing_key.pub', + 'Suites: stable', + 'Components: main']) self.assertEqual(f.filename, 'intel-gpu-jammy.list') @patch('inbm_lib.mqttclient.mqtt.mqtt.Client.connect') @@ -64,6 +72,28 @@ def test_raise_application_add_with_only_one_gpgKeyName_param(self, m_connect): "to be provided, or neither of them."): Inbc(p, 'source', False) + @patch('inbm_lib.mqttclient.mqtt.mqtt.Client.connect') + def test_create_add_deb_822_format_manifest_successfully(self, m_connect): + p = self.arg_parser.parse_args( + ['source', 'application', 'add', + '--sources', 'X-Repolib-Name: Google Chrome', + 'Enabled: yes', + 'Types: deb', + 'URIs: https://dl-ssl.google.com/linux/linux_signing_key.pub', + 'Suites: stable', + 'Components: main', + '--filename', 'intel-gpu-jammy.list']) + Inbc(p, 'source', False) + expected = 'source' \ + 'X-Repolib-Name: Google Chrome' \ + 'Enabled: yes' \ + 'Types: deb'\ + 'URIs: https://dl-ssl.google.com/linux/linux_signing_key.pub' \ + 'Suites: stable' \ + 'Components: main' \ + 'intel-gpu-jammy.list' + self.assertEqual(p.func(p), expected) + @patch('inbm_lib.mqttclient.mqtt.mqtt.Client.connect') def test_create_add_all_param_manifest_successfully(self, m_connect): p = self.arg_parser.parse_args( diff --git a/inbm/dispatcher-agent/dispatcher/source/source_command.py b/inbm/dispatcher-agent/dispatcher/source/source_command.py index 14280e228..1dd9e5100 100644 --- a/inbm/dispatcher-agent/dispatcher/source/source_command.py +++ b/inbm/dispatcher-agent/dispatcher/source/source_command.py @@ -120,8 +120,16 @@ def _handle_app_source_command( return Result(status=200, message="SUCCESS") if "add" in app_action: - gpg_key_uri = parsed_head.get_children("applicationSource/add/gpg")["uri"] - gpg_key_name = parsed_head.get_children("applicationSource/add/gpg")["keyname"] + gpg_key_uri = None + gpg_key_name = None + + try: + gpg_key_uri = parsed_head.get_children("applicationSource/add/gpg")["uri"] + gpg_key_name = parsed_head.get_children("applicationSource/add/gpg")["keyname"] + except XmlException: + # These children may not be present + logger.info(f"Optional GPG key parameters not present in manifest") + repo_filename = parsed_head.get_children("applicationSource/add/repo")["filename"] add_source_pkgs: list[str] = [] diff --git a/inbm/dispatcher-agent/fpm-template/usr/share/dispatcher-agent/manifest_schema.xsd b/inbm/dispatcher-agent/fpm-template/usr/share/dispatcher-agent/manifest_schema.xsd index 91964c256..75fdfcdfc 100644 --- a/inbm/dispatcher-agent/fpm-template/usr/share/dispatcher-agent/manifest_schema.xsd +++ b/inbm/dispatcher-agent/fpm-template/usr/share/dispatcher-agent/manifest_schema.xsd @@ -322,8 +322,8 @@ - - + + @@ -333,7 +333,7 @@ - + @@ -353,7 +353,7 @@ - + @@ -370,7 +370,7 @@ - + diff --git a/inbm/dispatcher-agent/tests/unit/source/test_ubuntu_source_cmd.py b/inbm/dispatcher-agent/tests/unit/source/test_ubuntu_source_cmd.py index fa28331b3..60e500191 100644 --- a/inbm/dispatcher-agent/tests/unit/source/test_ubuntu_source_cmd.py +++ b/inbm/dispatcher-agent/tests/unit/source/test_ubuntu_source_cmd.py @@ -213,7 +213,7 @@ def test_add_app_deb_822_format_successfully(self): file_name="intel-gpu-jammy.list", sources="X-Repolib-Name: Google Chrome" "Enabled: yes" - "Types:deb" + "Types: deb" "URIs: https://dl-ssl.google.com/linux/linux_signing_key.pub" "Suites: stable" "Components: main", From 4c81868eae4fd52d767e2cfa852cb79ebd243145 Mon Sep 17 00:00:00 2001 From: Natalie Gaston Date: Tue, 9 Jan 2024 13:25:08 -0800 Subject: [PATCH 04/14] Fix issue with Deb822 format example --- inbc-program/README.md | 53 ++++++++++++++++--- inbc-program/inbc/parser/source_app_parser.py | 2 +- .../dispatcher-agent/manifest_schema.xsd | 2 +- 3 files changed, 49 insertions(+), 8 deletions(-) diff --git a/inbc-program/README.md b/inbc-program/README.md index 35a02ede9..4d36ab54d 100644 --- a/inbc-program/README.md +++ b/inbc-program/README.md @@ -427,7 +427,7 @@ inbc source application add ``` ### Example -#### Add an Application Source (with remote GPG key) +#### Add an Application Source (non-deb822 format with remote GPG key) ``` inbc source application add --gpgKeyUri https://dl-ssl.google.com/linux/linux_signing_key.pub @@ -437,9 +437,52 @@ inbc source application add ``` #### Add an Application Source (using deb822 format) + +**NOTE:** In the Signed-By: Section, use the following guidelines. + + - Each blank line has a period in it. -> " ." + - Each line after the Signed-By: starts with a space -> " gibberish" + ``` inbc source application add - --sources "X-Repolib-Name: Google Chrome" "Enabled: yes" "Types: deb" "URIs: https://dl-ssl.google.com/linux/linux_signing_key.pub" "Suites: stable" "Components: main" + --sources + "Enabled: yes" + "Types: deb" + "URIs: http://dl.google.com/linux/chrome/deb/" + "Suites: stable" + "Components: main" + "Signed-By:" + " -----BEGIN PGP PUBLIC KEY BLOCK-----" + " Version: GnuPG v1.4.2.2 (GNU/Linux)" + " ." + " mQGiBEXwb0YRBADQva2NLpYXxgjNkbuP0LnPoEXruGmvi3XMIxjEUFuGNCP4Rj/a" + " kv2E5VixBP1vcQFDRJ+p1puh8NU0XERlhpyZrVMzzS/RdWdyXf7E5S8oqNXsoD1z" + " fvmI+i9b2EhHAA19Kgw7ifV8vMa4tkwslEmcTiwiw8lyUl28Wh4Et8SxzwCggDcA" + " feGqtn3PP5YAdD0km4S4XeMEAJjlrqPoPv2Gf//tfznY2UyS9PUqFCPLHgFLe80u" + " QhI2U5jt6jUKN4fHauvR6z3seSAsh1YyzyZCKxJFEKXCCqnrFSoh4WSJsbFNc4PN" + " b0V0SqiTCkWADZyLT5wll8sWuQ5ylTf3z1ENoHf+G3um3/wk/+xmEHvj9HCTBEXP" + " 78X0A/0Tqlhc2RBnEf+AqxWvM8sk8LzJI/XGjwBvKfXe+l3rnSR2kEAvGzj5Sg0X" + " 4XmfTg4Jl8BNjWyvm2Wmjfet41LPmYJKsux3g0b8yzQxeOA4pQKKAU3Z4+rgzGmf" + " HdwCG5MNT2A5XxD/eDd+L4fRx0HbFkIQoAi1J3YWQSiTk15fw7RMR29vZ2xlLCBJ" + " bmMuIExpbnV4IFBhY2thZ2UgU2lnbmluZyBLZXkgPGxpbnV4LXBhY2thZ2VzLWtl" + " eW1hc3RlckBnb29nbGUuY29tPohjBBMRAgAjAhsDBgsJCAcDAgQVAggDBBYCAwEC" + " HgECF4AFAkYVdn8CGQEACgkQoECDD3+sWZHKSgCfdq3HtNYJLv+XZleb6HN4zOcF" + " AJEAniSFbuv8V5FSHxeRimHx25671az+uQINBEXwb0sQCACuA8HT2nr+FM5y/kzI" + " A51ZcC46KFtIDgjQJ31Q3OrkYP8LbxOpKMRIzvOZrsjOlFmDVqitiVc7qj3lYp6U" + " rgNVaFv6Qu4bo2/ctjNHDDBdv6nufmusJUWq/9TwieepM/cwnXd+HMxu1XBKRVk9" + " XyAZ9SvfcW4EtxVgysI+XlptKFa5JCqFM3qJllVohMmr7lMwO8+sxTWTXqxsptJo" + " pZeKz+UBEEqPyw7CUIVYGC9ENEtIMFvAvPqnhj1GS96REMpry+5s9WKuLEaclWpd" + " K3krttbDlY1NaeQUCRvBYZ8iAG9YSLHUHMTuI2oea07Rh4dtIAqPwAX8xn36JAYG" + " 2vgLAAMFB/wKqaycjWAZwIe98Yt0qHsdkpmIbarD9fGiA6kfkK/UxjL/k7tmS4Vm" + " CljrrDZkPSQ/19mpdRcGXtb0NI9+nyM5trweTvtPw+HPkDiJlTaiCcx+izg79Fj9" + " KcofuNb3lPdXZb9tzf5oDnmm/B+4vkeTuEZJ//IFty8cmvCpzvY+DAz1Vo9rA+Zn" + " cpWY1n6z6oSS9AsyT/IFlWWBZZ17SpMHu+h4Bxy62+AbPHKGSujEGQhWq8ZRoJAT" + " G0KSObnmZ7FwFWu1e9XFoUCt0bSjiJWTIyaObMrWu/LvJ3e9I87HseSJStfw6fki" + " 5og9qFEkMrIrBCp3QGuQWBq/rTdMuwNFiEkEGBECAAkFAkXwb0sCGwwACgkQoECD" + " D3+sWZF/WACfeNAu1/1hwZtUo1bR+MWiCjpvHtwAnA1R3IHqFLQ2X3xJ40XPuAyY" + " /FJG" + " %20=Quqp" + " -----END PGP PUBLIC KEY BLOCK-----" --filename google-chrome.sources ``` @@ -462,10 +505,10 @@ inbc source application remove --filename google-chrome.list ``` -#### Remove an application source (Source File only) +#### Remove an application source (deb822 format) ```commandline inbc source application remove - --filename google-chrome.list + --filename google-chrome.sources ``` ## SOURCE APPLICATION UPDATE @@ -491,7 +534,6 @@ inbc source application update ## SOURCE APPLICATION LIST ### Description Lists Application sources -NOTE: Currently this only works on Ubuntu ### Usage ``` @@ -558,7 +600,6 @@ inbc source os update ## SOURCE OS LIST ### Description Lists OS sources -NOTE: Currently this only works on Ubuntu ### Usage ```commandline diff --git a/inbc-program/inbc/parser/source_app_parser.py b/inbc-program/inbc/parser/source_app_parser.py index 89180e574..3702f3690 100644 --- a/inbc-program/inbc/parser/source_app_parser.py +++ b/inbc-program/inbc/parser/source_app_parser.py @@ -36,7 +36,7 @@ def application_add(args: argparse.Namespace) -> str: manifest += '' for source in args.sources: - manifest += '' + source.strip() + '' + manifest += '' + source + '' manifest += ('' f'{create_xml_tag(arguments, "filename")}' diff --git a/inbm/dispatcher-agent/fpm-template/usr/share/dispatcher-agent/manifest_schema.xsd b/inbm/dispatcher-agent/fpm-template/usr/share/dispatcher-agent/manifest_schema.xsd index 75fdfcdfc..a8ea29ac0 100644 --- a/inbm/dispatcher-agent/fpm-template/usr/share/dispatcher-agent/manifest_schema.xsd +++ b/inbm/dispatcher-agent/fpm-template/usr/share/dispatcher-agent/manifest_schema.xsd @@ -333,7 +333,7 @@ - + From a932a094443e6fce750d4a0427e94ae2973fb548 Mon Sep 17 00:00:00 2001 From: Natalie Gaston Date: Tue, 9 Jan 2024 16:27:40 -0800 Subject: [PATCH 05/14] Integration tests for deb822 --- inbm/integration-reloaded/test/source/SOURCE.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/inbm/integration-reloaded/test/source/SOURCE.sh b/inbm/integration-reloaded/test/source/SOURCE.sh index c19cef04d..c43f6a0d5 100755 --- a/inbm/integration-reloaded/test/source/SOURCE.sh +++ b/inbm/integration-reloaded/test/source/SOURCE.sh @@ -16,6 +16,8 @@ OPERA_KEY_NAME="opera.gpg" OPERA_SOURCES="deb [arch=amd64 signed-by=/usr/share/keyrings/$OPERA_KEY_NAME] https://deb.opera.com/opera-stable/ stable non-free" OPERA_LIST="opera.list" NEW_APP_SOURCE="deb newsource" +CHROME_SOURCES="google-chrome.sources" +CHROME_DEB_822="Enabled: yes" "Types: deb" "URIs: http://dl.google.com/linux/chrome/deb/" "Suites: stable" "Components: main" "Signed-By:" " -----BEGIN PGP PUBLIC KEY BLOCK-----" " Version: GnuPG v1.4.2.2 (GNU/Linux)" " ." " mQGiBEXwb0YRBADQva2NLpYXxgjNkbuP0LnPoEXruGmvi3XMIxjEUFuGNCP4Rj/a" " kv2E5VixBP1vcQFDRJ+p1puh8NU0XERlhpyZrVMzzS/RdWdyXf7E5S8oqNXsoD1z" " fvmI+i9b2EhHAA19Kgw7ifV8vMa4tkwslEmcTiwiw8lyUl28Wh4Et8SxzwCggDcA" " feGqtn3PP5YAdD0km4S4XeMEAJjlrqPoPv2Gf//tfznY2UyS9PUqFCPLHgFLe80u" " QhI2U5jt6jUKN4fHauvR6z3seSAsh1YyzyZCKxJFEKXCCqnrFSoh4WSJsbFNc4PN" " b0V0SqiTCkWADZyLT5wll8sWuQ5ylTf3z1ENoHf+G3um3/wk/+xmEHvj9HCTBEXP" " 78X0A/0Tqlhc2RBnEf+AqxWvM8sk8LzJI/XGjwBvKfXe+l3rnSR2kEAvGzj5Sg0X" " 4XmfTg4Jl8BNjWyvm2Wmjfet41LPmYJKsux3g0b8yzQxeOA4pQKKAU3Z4+rgzGmf" " HdwCG5MNT2A5XxD/eDd+L4fRx0HbFkIQoAi1J3YWQSiTk15fw7RMR29vZ2xlLCBJ" " bmMuIExpbnV4IFBhY2thZ2UgU2lnbmluZyBLZXkgPGxpbnV4LXBhY2thZ2VzLWtl" " eW1hc3RlckBnb29nbGUuY29tPohjBBMRAgAjAhsDBgsJCAcDAgQVAggDBBYCAwEC" " HgECF4AFAkYVdn8CGQEACgkQoECDD3+sWZHKSgCfdq3HtNYJLv+XZleb6HN4zOcF" " AJEAniSFbuv8V5FSHxeRimHx25671az+uQINBEXwb0sQCACuA8HT2nr+FM5y/kzI" " A51ZcC46KFtIDgjQJ31Q3OrkYP8LbxOpKMRIzvOZrsjOlFmDVqitiVc7qj3lYp6U" " rgNVaFv6Qu4bo2/ctjNHDDBdv6nufmusJUWq/9TwieepM/cwnXd+HMxu1XBKRVk9" " XyAZ9SvfcW4EtxVgysI+XlptKFa5JCqFM3qJllVohMmr7lMwO8+sxTWTXqxsptJo" " pZeKz+UBEEqPyw7CUIVYGC9ENEtIMFvAvPqnhj1GS96REMpry+5s9WKuLEaclWpd" " K3krttbDlY1NaeQUCRvBYZ8iAG9YSLHUHMTuI2oea07Rh4dtIAqPwAX8xn36JAYG" " 2vgLAAMFB/wKqaycjWAZwIe98Yt0qHsdkpmIbarD9fGiA6kfkK/UxjL/k7tmS4Vm" " CljrrDZkPSQ/19mpdRcGXtb0NI9+nyM5trweTvtPw+HPkDiJlTaiCcx+izg79Fj9" " KcofuNb3lPdXZb9tzf5oDnmm/B+4vkeTuEZJ//IFty8cmvCpzvY+DAz1Vo9rA+Zn" " cpWY1n6z6oSS9AsyT/IFlWWBZZ17SpMHu+h4Bxy62+AbPHKGSujEGQhWq8ZRoJAT" " G0KSObnmZ7FwFWu1e9XFoUCt0bSjiJWTIyaObMrWu/LvJ3e9I87HseSJStfw6fki" " 5og9qFEkMrIrBCp3QGuQWBq/rTdMuwNFiEkEGBECAAkFAkXwb0sCGwwACgkQoECD" " D3+sWZF/WACfeNAu1/1hwZtUo1bR+MWiCjpvHtwAnA1R3IHqFLQ2X3xJ40XPuAyY" " /FJG" " %20=Quqp" " -----END PGP PUBLIC KEY BLOCK-----" cp "$APT_SOURCES" "$BAK_APT_SOURCES" @@ -55,6 +57,11 @@ if [ ! -e "/usr/share/keyrings/$OPERA_KEY_NAME" ]; then fi inbc source application list 2>&1 | grep "$OPERA_KEY_NAME" inbc source application remove --gpgKeyName "$OPERA_KEY_NAME" --filename "$OPERA_LIST" +inbc source application add --filename "$CHROME_SOURCES" --sources "$CHROME_DEB_822" +if [ ! -e "/etc/apt/sources.list.d/$CHROME_SOURCES" ]; then + echo "Error: The file '/etc/apt/sources.list.d/$CHROME_SOURCES' does not exist!" + exit 1 +fi if inbc source application list 2>&1 | grep -q "$OPERA_KEY_NAME"; then echo "Error: $OPERA_KEY_NAME should not be present in the application list after removal" @@ -62,6 +69,7 @@ if inbc source application list 2>&1 | grep -q "$OPERA_KEY_NAME"; then fi inbc source application add --gpgKeyUri "$OPERA_KEY_URI" --gpgKeyName "$OPERA_KEY_NAME" --sources "$OPERA_SOURCES" --filename "$OPERA_LIST" + inbc source application update --sources "$NEW_APP_SOURCE" --filename "$OPERA_LIST" inbc source application list 2>&1 | grep "$NEW_APP_SOURCE" From cc989df96018d8e55966e5cfa693f1d52552127b Mon Sep 17 00:00:00 2001 From: Natalie Gaston Date: Tue, 9 Jan 2024 19:05:02 -0800 Subject: [PATCH 06/14] Fix integration test --- inbm/integration-reloaded/README.md | 18 +++++++++--------- .../integration-reloaded/test/source/SOURCE.sh | 13 ++++++++++--- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/inbm/integration-reloaded/README.md b/inbm/integration-reloaded/README.md index 1cb2c9ed5..3a96a3a1b 100644 --- a/inbm/integration-reloaded/README.md +++ b/inbm/integration-reloaded/README.md @@ -1,20 +1,20 @@ # Introduction -integration-reloaded is sub-project within 'inb' which helps create a Ubuntu 20.04 or 22.04 server environment +integration-reloaded is subproject within 'inb' which helps create a Ubuntu 20.04 or 22.04 server environment with a BTRFS file system (mounted as / ) # Uses 1. It can be used as a test box for testing 'inb' artifacts 2. Demo machine -3. Currently being used as a part of iotg-inb's CI system. +3. It is currently being used as a part of iotg-inb's CI system. # Local setup -If you want to setup a system ready to go with a click of a button...you will have to perform a one-time setup +If you want to set up a system ready to go with a click of a button...you will have to perform a one-time setup on your local dev system -## Pre-requistes: +## Pre-requisites: Installing Vagrant, Vagrant-libvirt, Qmenu-KVM and the plugins etc 1. Download vagrant from vagrant https://www.vagrantup.com/downloads.html and @@ -22,12 +22,12 @@ Installing Vagrant, Vagrant-libvirt, Qmenu-KVM and the plugins etc 2. Edit the /etc/apt/sources.list and uncomment all the deb-src lines -3. Run the below commands in sequence (preferrably as root) +3. Run the below commands in sequence (preferably as root) ``` apt update - apt install qemu qemu-kvm libvirt-bin + apt install qemu qemu-kvm libvirt-daemon-system libvirt-clients apt-get build-dep vagrant ruby-libvirt - apt-get install qemu libvirt-bin ebtables dnsmasq + apt-get install qemu libvirt-daemon-system libvirt-clients ebtables dnsmasq apt-get install libxslt-dev libvirt-dev zlib1g-dev ruby-dev ``` @@ -38,8 +38,8 @@ vagrant plugin install vagrant-libvirt ``` ## How to use it -1. Clone the iotg-inb repo -2. `cd ~/iotg-inb/integration-reloaded` +1. Clone the `intel-inb-manageability` repo +2. `cd ~/intel-inb-manageability/inbm/integration-reloaded` 3. Create a folder in integration-reloaded called `input` 4. Download all the iotg-inb artifacts in that `input` folder and unzip the artifacts 5. export your docker username as DOCKER_USERNAME and your docker password as DOCKER_PASSWORD diff --git a/inbm/integration-reloaded/test/source/SOURCE.sh b/inbm/integration-reloaded/test/source/SOURCE.sh index c43f6a0d5..42732df30 100755 --- a/inbm/integration-reloaded/test/source/SOURCE.sh +++ b/inbm/integration-reloaded/test/source/SOURCE.sh @@ -16,8 +16,8 @@ OPERA_KEY_NAME="opera.gpg" OPERA_SOURCES="deb [arch=amd64 signed-by=/usr/share/keyrings/$OPERA_KEY_NAME] https://deb.opera.com/opera-stable/ stable non-free" OPERA_LIST="opera.list" NEW_APP_SOURCE="deb newsource" -CHROME_SOURCES="google-chrome.sources" -CHROME_DEB_822="Enabled: yes" "Types: deb" "URIs: http://dl.google.com/linux/chrome/deb/" "Suites: stable" "Components: main" "Signed-By:" " -----BEGIN PGP PUBLIC KEY BLOCK-----" " Version: GnuPG v1.4.2.2 (GNU/Linux)" " ." " mQGiBEXwb0YRBADQva2NLpYXxgjNkbuP0LnPoEXruGmvi3XMIxjEUFuGNCP4Rj/a" " kv2E5VixBP1vcQFDRJ+p1puh8NU0XERlhpyZrVMzzS/RdWdyXf7E5S8oqNXsoD1z" " fvmI+i9b2EhHAA19Kgw7ifV8vMa4tkwslEmcTiwiw8lyUl28Wh4Et8SxzwCggDcA" " feGqtn3PP5YAdD0km4S4XeMEAJjlrqPoPv2Gf//tfznY2UyS9PUqFCPLHgFLe80u" " QhI2U5jt6jUKN4fHauvR6z3seSAsh1YyzyZCKxJFEKXCCqnrFSoh4WSJsbFNc4PN" " b0V0SqiTCkWADZyLT5wll8sWuQ5ylTf3z1ENoHf+G3um3/wk/+xmEHvj9HCTBEXP" " 78X0A/0Tqlhc2RBnEf+AqxWvM8sk8LzJI/XGjwBvKfXe+l3rnSR2kEAvGzj5Sg0X" " 4XmfTg4Jl8BNjWyvm2Wmjfet41LPmYJKsux3g0b8yzQxeOA4pQKKAU3Z4+rgzGmf" " HdwCG5MNT2A5XxD/eDd+L4fRx0HbFkIQoAi1J3YWQSiTk15fw7RMR29vZ2xlLCBJ" " bmMuIExpbnV4IFBhY2thZ2UgU2lnbmluZyBLZXkgPGxpbnV4LXBhY2thZ2VzLWtl" " eW1hc3RlckBnb29nbGUuY29tPohjBBMRAgAjAhsDBgsJCAcDAgQVAggDBBYCAwEC" " HgECF4AFAkYVdn8CGQEACgkQoECDD3+sWZHKSgCfdq3HtNYJLv+XZleb6HN4zOcF" " AJEAniSFbuv8V5FSHxeRimHx25671az+uQINBEXwb0sQCACuA8HT2nr+FM5y/kzI" " A51ZcC46KFtIDgjQJ31Q3OrkYP8LbxOpKMRIzvOZrsjOlFmDVqitiVc7qj3lYp6U" " rgNVaFv6Qu4bo2/ctjNHDDBdv6nufmusJUWq/9TwieepM/cwnXd+HMxu1XBKRVk9" " XyAZ9SvfcW4EtxVgysI+XlptKFa5JCqFM3qJllVohMmr7lMwO8+sxTWTXqxsptJo" " pZeKz+UBEEqPyw7CUIVYGC9ENEtIMFvAvPqnhj1GS96REMpry+5s9WKuLEaclWpd" " K3krttbDlY1NaeQUCRvBYZ8iAG9YSLHUHMTuI2oea07Rh4dtIAqPwAX8xn36JAYG" " 2vgLAAMFB/wKqaycjWAZwIe98Yt0qHsdkpmIbarD9fGiA6kfkK/UxjL/k7tmS4Vm" " CljrrDZkPSQ/19mpdRcGXtb0NI9+nyM5trweTvtPw+HPkDiJlTaiCcx+izg79Fj9" " KcofuNb3lPdXZb9tzf5oDnmm/B+4vkeTuEZJ//IFty8cmvCpzvY+DAz1Vo9rA+Zn" " cpWY1n6z6oSS9AsyT/IFlWWBZZ17SpMHu+h4Bxy62+AbPHKGSujEGQhWq8ZRoJAT" " G0KSObnmZ7FwFWu1e9XFoUCt0bSjiJWTIyaObMrWu/LvJ3e9I87HseSJStfw6fki" " 5og9qFEkMrIrBCp3QGuQWBq/rTdMuwNFiEkEGBECAAkFAkXwb0sCGwwACgkQoECD" " D3+sWZF/WACfeNAu1/1hwZtUo1bR+MWiCjpvHtwAnA1R3IHqFLQ2X3xJ40XPuAyY" " /FJG" " %20=Quqp" " -----END PGP PUBLIC KEY BLOCK-----" +CHROME_SOURCES_FILE="google-chrome.sources" +CHROME_DEB_822=("Enabled: yes" "Types: deb" "URIs: http://dl.google.com/linux/chrome/deb/" "Suites: stable" "Components: main" "Signed-By:" " -----BEGIN PGP PUBLIC KEY BLOCK-----" " Version: GnuPG v1.4.2.2 (GNU/Linux)" " ." " mQGiBEXwb0YRBADQva2NLpYXxgjNkbuP0LnPoEXruGmvi3XMIxjEUFuGNCP4Rj/a" " kv2E5VixBP1vcQFDRJ+p1puh8NU0XERlhpyZrVMzzS/RdWdyXf7E5S8oqNXsoD1z" " fvmI+i9b2EhHAA19Kgw7ifV8vMa4tkwslEmcTiwiw8lyUl28Wh4Et8SxzwCggDcA" " feGqtn3PP5YAdD0km4S4XeMEAJjlrqPoPv2Gf//tfznY2UyS9PUqFCPLHgFLe80u" " QhI2U5jt6jUKN4fHauvR6z3seSAsh1YyzyZCKxJFEKXCCqnrFSoh4WSJsbFNc4PN" " b0V0SqiTCkWADZyLT5wll8sWuQ5ylTf3z1ENoHf+G3um3/wk/+xmEHvj9HCTBEXP" " 78X0A/0Tqlhc2RBnEf+AqxWvM8sk8LzJI/XGjwBvKfXe+l3rnSR2kEAvGzj5Sg0X" " 4XmfTg4Jl8BNjWyvm2Wmjfet41LPmYJKsux3g0b8yzQxeOA4pQKKAU3Z4+rgzGmf" " HdwCG5MNT2A5XxD/eDd+L4fRx0HbFkIQoAi1J3YWQSiTk15fw7RMR29vZ2xlLCBJ" " bmMuIExpbnV4IFBhY2thZ2UgU2lnbmluZyBLZXkgPGxpbnV4LXBhY2thZ2VzLWtl" " eW1hc3RlckBnb29nbGUuY29tPohjBBMRAgAjAhsDBgsJCAcDAgQVAggDBBYCAwEC" " HgECF4AFAkYVdn8CGQEACgkQoECDD3+sWZHKSgCfdq3HtNYJLv+XZleb6HN4zOcF" " AJEAniSFbuv8V5FSHxeRimHx25671az+uQINBEXwb0sQCACuA8HT2nr+FM5y/kzI" " A51ZcC46KFtIDgjQJ31Q3OrkYP8LbxOpKMRIzvOZrsjOlFmDVqitiVc7qj3lYp6U" " rgNVaFv6Qu4bo2/ctjNHDDBdv6nufmusJUWq/9TwieepM/cwnXd+HMxu1XBKRVk9" " XyAZ9SvfcW4EtxVgysI+XlptKFa5JCqFM3qJllVohMmr7lMwO8+sxTWTXqxsptJo" " pZeKz+UBEEqPyw7CUIVYGC9ENEtIMFvAvPqnhj1GS96REMpry+5s9WKuLEaclWpd" " K3krttbDlY1NaeQUCRvBYZ8iAG9YSLHUHMTuI2oea07Rh4dtIAqPwAX8xn36JAYG" " 2vgLAAMFB/wKqaycjWAZwIe98Yt0qHsdkpmIbarD9fGiA6kfkK/UxjL/k7tmS4Vm" " CljrrDZkPSQ/19mpdRcGXtb0NI9+nyM5trweTvtPw+HPkDiJlTaiCcx+izg79Fj9" " KcofuNb3lPdXZb9tzf5oDnmm/B+4vkeTuEZJ//IFty8cmvCpzvY+DAz1Vo9rA+Zn" " cpWY1n6z6oSS9AsyT/IFlWWBZZ17SpMHu+h4Bxy62+AbPHKGSujEGQhWq8ZRoJAT" " G0KSObnmZ7FwFWu1e9XFoUCt0bSjiJWTIyaObMrWu/LvJ3e9I87HseSJStfw6fki" " 5og9qFEkMrIrBCp3QGuQWBq/rTdMuwNFiEkEGBECAAkFAkXwb0sCGwwACgkQoECD" " D3+sWZF/WACfeNAu1/1hwZtUo1bR+MWiCjpvHtwAnA1R3IHqFLQ2X3xJ40XPuAyY" " /FJG" " %20=Quqp" " -----END PGP PUBLIC KEY BLOCK-----") cp "$APT_SOURCES" "$BAK_APT_SOURCES" @@ -57,7 +57,14 @@ if [ ! -e "/usr/share/keyrings/$OPERA_KEY_NAME" ]; then fi inbc source application list 2>&1 | grep "$OPERA_KEY_NAME" inbc source application remove --gpgKeyName "$OPERA_KEY_NAME" --filename "$OPERA_LIST" -inbc source application add --filename "$CHROME_SOURCES" --sources "$CHROME_DEB_822" + +# Create and execute INBC source application add command for deb822 format +DEB822="inbc source application add --filename $CHROME_SOURCES_FILE --sources" +for line in ${CHROME_DEB_822[@]}; do + DEB822+="${line}" +done +$DEB822 + if [ ! -e "/etc/apt/sources.list.d/$CHROME_SOURCES" ]; then echo "Error: The file '/etc/apt/sources.list.d/$CHROME_SOURCES' does not exist!" exit 1 From f97fa7f720813abfaa4dea2bbf8ced8f5a70a19d Mon Sep 17 00:00:00 2001 From: Natalie Gaston Date: Tue, 9 Jan 2024 20:09:12 -0800 Subject: [PATCH 07/14] fix IT test --- inbm/integration-reloaded/test/source/SOURCE.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inbm/integration-reloaded/test/source/SOURCE.sh b/inbm/integration-reloaded/test/source/SOURCE.sh index 42732df30..99e656e37 100755 --- a/inbm/integration-reloaded/test/source/SOURCE.sh +++ b/inbm/integration-reloaded/test/source/SOURCE.sh @@ -59,9 +59,9 @@ inbc source application list 2>&1 | grep "$OPERA_KEY_NAME" inbc source application remove --gpgKeyName "$OPERA_KEY_NAME" --filename "$OPERA_LIST" # Create and execute INBC source application add command for deb822 format -DEB822="inbc source application add --filename $CHROME_SOURCES_FILE --sources" +DEB822="inbc source application add --filename $CHROME_SOURCES_FILE --sources " for line in ${CHROME_DEB_822[@]}; do - DEB822+="${line}" + DEB822+='"${line} "' done $DEB822 From e635a2a1820b06bf40bd05eb3f7ffce0455171b4 Mon Sep 17 00:00:00 2001 From: Natalie Gaston Date: Tue, 9 Jan 2024 20:21:33 -0800 Subject: [PATCH 08/14] fix IT test --- inbm/integration-reloaded/test/source/SOURCE.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inbm/integration-reloaded/test/source/SOURCE.sh b/inbm/integration-reloaded/test/source/SOURCE.sh index 99e656e37..336d81a44 100755 --- a/inbm/integration-reloaded/test/source/SOURCE.sh +++ b/inbm/integration-reloaded/test/source/SOURCE.sh @@ -61,7 +61,7 @@ inbc source application remove --gpgKeyName "$OPERA_KEY_NAME" --filename "$OPERA # Create and execute INBC source application add command for deb822 format DEB822="inbc source application add --filename $CHROME_SOURCES_FILE --sources " for line in ${CHROME_DEB_822[@]}; do - DEB822+='"${line} "' + DEB822+="\"${line} \"" done $DEB822 From ed1c9faefe30d2fe249a270f4e05dba311735e60 Mon Sep 17 00:00:00 2001 From: Natalie Gaston Date: Tue, 9 Jan 2024 20:39:24 -0800 Subject: [PATCH 09/14] another try at IT test --- inbm/integration-reloaded/test/source/SOURCE.sh | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/inbm/integration-reloaded/test/source/SOURCE.sh b/inbm/integration-reloaded/test/source/SOURCE.sh index 336d81a44..5d80850c7 100755 --- a/inbm/integration-reloaded/test/source/SOURCE.sh +++ b/inbm/integration-reloaded/test/source/SOURCE.sh @@ -58,12 +58,7 @@ fi inbc source application list 2>&1 | grep "$OPERA_KEY_NAME" inbc source application remove --gpgKeyName "$OPERA_KEY_NAME" --filename "$OPERA_LIST" -# Create and execute INBC source application add command for deb822 format -DEB822="inbc source application add --filename $CHROME_SOURCES_FILE --sources " -for line in ${CHROME_DEB_822[@]}; do - DEB822+="\"${line} \"" -done -$DEB822 +inbc source application add --filename $CHROME_SOURCES_FILE --sources \"Enabled: yes\" \"Types: deb\" \"URIs: http://dl.google.com/linux/chrome/deb/\" \"Suites: stable\" \"Components: main\"" if [ ! -e "/etc/apt/sources.list.d/$CHROME_SOURCES" ]; then echo "Error: The file '/etc/apt/sources.list.d/$CHROME_SOURCES' does not exist!" From 2b51189131942372b59ec37182e19c74e7df55c2 Mon Sep 17 00:00:00 2001 From: Natalie Gaston Date: Tue, 9 Jan 2024 20:51:20 -0800 Subject: [PATCH 10/14] remove extra quote --- inbm/integration-reloaded/test/source/SOURCE.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inbm/integration-reloaded/test/source/SOURCE.sh b/inbm/integration-reloaded/test/source/SOURCE.sh index 5d80850c7..dde20b449 100755 --- a/inbm/integration-reloaded/test/source/SOURCE.sh +++ b/inbm/integration-reloaded/test/source/SOURCE.sh @@ -58,7 +58,7 @@ fi inbc source application list 2>&1 | grep "$OPERA_KEY_NAME" inbc source application remove --gpgKeyName "$OPERA_KEY_NAME" --filename "$OPERA_LIST" -inbc source application add --filename $CHROME_SOURCES_FILE --sources \"Enabled: yes\" \"Types: deb\" \"URIs: http://dl.google.com/linux/chrome/deb/\" \"Suites: stable\" \"Components: main\"" +inbc source application add --filename $CHROME_SOURCES_FILE --sources \"Enabled: yes\" \"Types: deb\" \"URIs: http://dl.google.com/linux/chrome/deb/\" \"Suites: stable\" \"Components: main\" if [ ! -e "/etc/apt/sources.list.d/$CHROME_SOURCES" ]; then echo "Error: The file '/etc/apt/sources.list.d/$CHROME_SOURCES' does not exist!" From 85d82323a68074ddf57bc9dc9e0e76725b739aa4 Mon Sep 17 00:00:00 2001 From: Natalie Gaston Date: Tue, 9 Jan 2024 22:17:54 -0800 Subject: [PATCH 11/14] remove sources file --- inbm/integration-reloaded/test/source/SOURCE.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/inbm/integration-reloaded/test/source/SOURCE.sh b/inbm/integration-reloaded/test/source/SOURCE.sh index dde20b449..1f0a6f4ea 100755 --- a/inbm/integration-reloaded/test/source/SOURCE.sh +++ b/inbm/integration-reloaded/test/source/SOURCE.sh @@ -60,16 +60,22 @@ inbc source application remove --gpgKeyName "$OPERA_KEY_NAME" --filename "$OPERA inbc source application add --filename $CHROME_SOURCES_FILE --sources \"Enabled: yes\" \"Types: deb\" \"URIs: http://dl.google.com/linux/chrome/deb/\" \"Suites: stable\" \"Components: main\" -if [ ! -e "/etc/apt/sources.list.d/$CHROME_SOURCES" ]; then - echo "Error: The file '/etc/apt/sources.list.d/$CHROME_SOURCES' does not exist!" +if [ ! -e "/etc/apt/sources.list.d/$CHROME_SOURCES_FILE" ]; then + echo "Error: The file '/etc/apt/sources.list.d/$CHROME_SOURCES_FILE' does not exist!" exit 1 fi +inbc source application remove --filename "$CHROME_SOURCES_FILE" if inbc source application list 2>&1 | grep -q "$OPERA_KEY_NAME"; then echo "Error: $OPERA_KEY_NAME should not be present in the application list after removal" exit 1 fi +if inbc source application list 2>&1 | grep -q "$CHROME_SOURCES_FILE"; then + echo "Error: $CHROME_SOURCES_FILE should not be present in the application list after removal" + exit 1 +fi + inbc source application add --gpgKeyUri "$OPERA_KEY_URI" --gpgKeyName "$OPERA_KEY_NAME" --sources "$OPERA_SOURCES" --filename "$OPERA_LIST" inbc source application update --sources "$NEW_APP_SOURCE" --filename "$OPERA_LIST" From 1bcad45ec1503fffc58b8497defb4f43a6b87d09 Mon Sep 17 00:00:00 2001 From: Natalie Gaston Date: Tue, 9 Jan 2024 22:34:02 -0800 Subject: [PATCH 12/14] handle missing gpg key on remove --- inbm/dispatcher-agent/dispatcher/source/source_command.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/inbm/dispatcher-agent/dispatcher/source/source_command.py b/inbm/dispatcher-agent/dispatcher/source/source_command.py index 1dd9e5100..4b30b5cc8 100644 --- a/inbm/dispatcher-agent/dispatcher/source/source_command.py +++ b/inbm/dispatcher-agent/dispatcher/source/source_command.py @@ -112,7 +112,12 @@ def _handle_app_source_command( return Result(status=200, message=serialized_list) if "remove" in app_action: - keyname = parsed_head.get_children("applicationSource/remove/gpg")["keyname"] + keyname = None + try: + keyname = parsed_head.get_children("applicationSource/remove/gpg")["keyname"] + except XmlException: + # These children may not be present + logger.info(f"Optional GPG key parameters not present in manifest") filename = parsed_head.get_children("applicationSource/remove/repo")["filename"] application_source_manager.remove( ApplicationRemoveSourceParameters(file_name=filename, gpg_key_name=keyname) From 643edcf47902730e632b1443f3af2d96dc9da077 Mon Sep 17 00:00:00 2001 From: Natalie Gaston Date: Tue, 9 Jan 2024 22:56:53 -0800 Subject: [PATCH 13/14] remove unused line --- inbm/integration-reloaded/test/source/SOURCE.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/inbm/integration-reloaded/test/source/SOURCE.sh b/inbm/integration-reloaded/test/source/SOURCE.sh index 1f0a6f4ea..e8c69ef13 100755 --- a/inbm/integration-reloaded/test/source/SOURCE.sh +++ b/inbm/integration-reloaded/test/source/SOURCE.sh @@ -17,7 +17,6 @@ OPERA_SOURCES="deb [arch=amd64 signed-by=/usr/share/keyrings/$OPERA_KEY_NAME] ht OPERA_LIST="opera.list" NEW_APP_SOURCE="deb newsource" CHROME_SOURCES_FILE="google-chrome.sources" -CHROME_DEB_822=("Enabled: yes" "Types: deb" "URIs: http://dl.google.com/linux/chrome/deb/" "Suites: stable" "Components: main" "Signed-By:" " -----BEGIN PGP PUBLIC KEY BLOCK-----" " Version: GnuPG v1.4.2.2 (GNU/Linux)" " ." " mQGiBEXwb0YRBADQva2NLpYXxgjNkbuP0LnPoEXruGmvi3XMIxjEUFuGNCP4Rj/a" " kv2E5VixBP1vcQFDRJ+p1puh8NU0XERlhpyZrVMzzS/RdWdyXf7E5S8oqNXsoD1z" " fvmI+i9b2EhHAA19Kgw7ifV8vMa4tkwslEmcTiwiw8lyUl28Wh4Et8SxzwCggDcA" " feGqtn3PP5YAdD0km4S4XeMEAJjlrqPoPv2Gf//tfznY2UyS9PUqFCPLHgFLe80u" " QhI2U5jt6jUKN4fHauvR6z3seSAsh1YyzyZCKxJFEKXCCqnrFSoh4WSJsbFNc4PN" " b0V0SqiTCkWADZyLT5wll8sWuQ5ylTf3z1ENoHf+G3um3/wk/+xmEHvj9HCTBEXP" " 78X0A/0Tqlhc2RBnEf+AqxWvM8sk8LzJI/XGjwBvKfXe+l3rnSR2kEAvGzj5Sg0X" " 4XmfTg4Jl8BNjWyvm2Wmjfet41LPmYJKsux3g0b8yzQxeOA4pQKKAU3Z4+rgzGmf" " HdwCG5MNT2A5XxD/eDd+L4fRx0HbFkIQoAi1J3YWQSiTk15fw7RMR29vZ2xlLCBJ" " bmMuIExpbnV4IFBhY2thZ2UgU2lnbmluZyBLZXkgPGxpbnV4LXBhY2thZ2VzLWtl" " eW1hc3RlckBnb29nbGUuY29tPohjBBMRAgAjAhsDBgsJCAcDAgQVAggDBBYCAwEC" " HgECF4AFAkYVdn8CGQEACgkQoECDD3+sWZHKSgCfdq3HtNYJLv+XZleb6HN4zOcF" " AJEAniSFbuv8V5FSHxeRimHx25671az+uQINBEXwb0sQCACuA8HT2nr+FM5y/kzI" " A51ZcC46KFtIDgjQJ31Q3OrkYP8LbxOpKMRIzvOZrsjOlFmDVqitiVc7qj3lYp6U" " rgNVaFv6Qu4bo2/ctjNHDDBdv6nufmusJUWq/9TwieepM/cwnXd+HMxu1XBKRVk9" " XyAZ9SvfcW4EtxVgysI+XlptKFa5JCqFM3qJllVohMmr7lMwO8+sxTWTXqxsptJo" " pZeKz+UBEEqPyw7CUIVYGC9ENEtIMFvAvPqnhj1GS96REMpry+5s9WKuLEaclWpd" " K3krttbDlY1NaeQUCRvBYZ8iAG9YSLHUHMTuI2oea07Rh4dtIAqPwAX8xn36JAYG" " 2vgLAAMFB/wKqaycjWAZwIe98Yt0qHsdkpmIbarD9fGiA6kfkK/UxjL/k7tmS4Vm" " CljrrDZkPSQ/19mpdRcGXtb0NI9+nyM5trweTvtPw+HPkDiJlTaiCcx+izg79Fj9" " KcofuNb3lPdXZb9tzf5oDnmm/B+4vkeTuEZJ//IFty8cmvCpzvY+DAz1Vo9rA+Zn" " cpWY1n6z6oSS9AsyT/IFlWWBZZ17SpMHu+h4Bxy62+AbPHKGSujEGQhWq8ZRoJAT" " G0KSObnmZ7FwFWu1e9XFoUCt0bSjiJWTIyaObMrWu/LvJ3e9I87HseSJStfw6fki" " 5og9qFEkMrIrBCp3QGuQWBq/rTdMuwNFiEkEGBECAAkFAkXwb0sCGwwACgkQoECD" " D3+sWZF/WACfeNAu1/1hwZtUo1bR+MWiCjpvHtwAnA1R3IHqFLQ2X3xJ40XPuAyY" " /FJG" " %20=Quqp" " -----END PGP PUBLIC KEY BLOCK-----") cp "$APT_SOURCES" "$BAK_APT_SOURCES" From 2f5b3ecbb74f437ef23f953f6cb8fb4049edf74f Mon Sep 17 00:00:00 2001 From: Natalie Gaston Date: Wed, 10 Jan 2024 14:00:52 -0800 Subject: [PATCH 14/14] review comments --- docs/Manifest Parameters.md | 87 +++++++++++++++---- .../tests/unit/test_source_app_parser.py | 4 +- .../dispatcher-agent/manifest_schema.xsd | 4 +- .../unit/source/test_ubuntu_source_cmd.py | 2 +- 4 files changed, 75 insertions(+), 22 deletions(-) diff --git a/docs/Manifest Parameters.md b/docs/Manifest Parameters.md index 6dca55728..31b9efe74 100644 --- a/docs/Manifest Parameters.md +++ b/docs/Manifest Parameters.md @@ -958,6 +958,59 @@ The query command can be used to gather information about the system and the Vis ``` +#### Source Application Add Manifest Example (deb822 format) +```xml + + + source + + + + Enabled: yes + Types: deb + URIs: http://dl.google.com/linux/chrome/deb/ + Suites: stable + Components: main + Signed-By: + -----BEGIN PGP PUBLIC KEY BLOCK----- + Version: GnuPG v1.4.2.2 (GNU/Linux) + . + mQGiBEXwb0YRBADQva2NLpYXxgjNkbuP0LnPoEXruGmvi3XMIxjEUFuGNCP4Rj/a + kv2E5VixBP1vcQFDRJ+p1puh8NU0XERlhpyZrVMzzS/RdWdyXf7E5S8oqNXsoD1z + fvmI+i9b2EhHAA19Kgw7ifV8vMa4tkwslEmcTiwiw8lyUl28Wh4Et8SxzwCggDcA + feGqtn3PP5YAdD0km4S4XeMEAJjlrqPoPv2Gf//tfznY2UyS9PUqFCPLHgFLe80u + QhI2U5jt6jUKN4fHauvR6z3seSAsh1YyzyZCKxJFEKXCCqnrFSoh4WSJsbFNc4PN + b0V0SqiTCkWADZyLT5wll8sWuQ5ylTf3z1ENoHf+G3um3/wk/+xmEHvj9HCTBEXP + 78X0A/0Tqlhc2RBnEf+AqxWvM8sk8LzJI/XGjwBvKfXe+l3rnSR2kEAvGzj5Sg0X + 4XmfTg4Jl8BNjWyvm2Wmjfet41LPmYJKsux3g0b8yzQxeOA4pQKKAU3Z4+rgzGmf + HdwCG5MNT2A5XxD/eDd+L4fRx0HbFkIQoAi1J3YWQSiTk15fw7RMR29vZ2xlLCBJ + bmMuIExpbnV4IFBhY2thZ2UgU2lnbmluZyBLZXkgPGxpbnV4LXBhY2thZ2VzLWtl + eW1hc3RlckBnb29nbGUuY29tPohjBBMRAgAjAhsDBgsJCAcDAgQVAggDBBYCAwEC + HgECF4AFAkYVdn8CGQEACgkQoECDD3+sWZHKSgCfdq3HtNYJLv+XZleb6HN4zOcF + AJEAniSFbuv8V5FSHxeRimHx25671az+uQINBEXwb0sQCACuA8HT2nr+FM5y/kzI + A51ZcC46KFtIDgjQJ31Q3OrkYP8LbxOpKMRIzvOZrsjOlFmDVqitiVc7qj3lYp6U + rgNVaFv6Qu4bo2/ctjNHDDBdv6nufmusJUWq/9TwieepM/cwnXd+HMxu1XBKRVk9 + XyAZ9SvfcW4EtxVgysI+XlptKFa5JCqFM3qJllVohMmr7lMwO8+sxTWTXqxsptJo + pZeKz+UBEEqPyw7CUIVYGC9ENEtIMFvAvPqnhj1GS96REMpry+5s9WKuLEaclWpd + K3krttbDlY1NaeQUCRvBYZ8iAG9YSLHUHMTuI2oea07Rh4dtIAqPwAX8xn36JAYG + 2vgLAAMFB/wKqaycjWAZwIe98Yt0qHsdkpmIbarD9fGiA6kfkK/UxjL/k7tmS4Vm + CljrrDZkPSQ/19mpdRcGXtb0NI9+nyM5trweTvtPw+HPkDiJlTaiCcx+izg79Fj9 + KcofuNb3lPdXZb9tzf5oDnmm/B+4vkeTuEZJ//IFty8cmvCpzvY+DAz1Vo9rA+Zn + cpWY1n6z6oSS9AsyT/IFlWWBZZ17SpMHu+h4Bxy62+AbPHKGSujEGQhWq8ZRoJAT + G0KSObnmZ7FwFWu1e9XFoUCt0bSjiJWTIyaObMrWu/LvJ3e9I87HseSJStfw6fki + 5og9qFEkMrIrBCp3QGuQWBq/rTdMuwNFiEkEGBECAAkFAkXwb0sCGwwACgkQoECD + D3+sWZF/WACfeNAu1/1hwZtUo1bR+MWiCjpvHtwAnA1R3IHqFLQ2X3xJ40XPuAyY + /FJG + %20=Quqp + -----END PGP PUBLIC KEY BLOCK----- + + google-chrome.sources + + + + +``` + #### Source Application Update Manifest Parameters | Tag | Example | Required/Optional | Notes | |:-----------------------------------------|:-----------------------------------------------------------------------------------------------|:-----------------:|:------| @@ -998,22 +1051,22 @@ The query command can be used to gather information about the system and the Vis ``` #### Source Application Remove Manifest Parameters -| Tag | Example | Required/Optional | Notes | -|:-----------------------------------------|:-----------------------------------------|:-----------------:|:------| -| `` | `` | R | | -| `` | `` | R | | -| `` | `source` | R | | -| `` | `` | R | | -| `` | `` | R | | -| `` | `` | O | | -| `` | `google-chrome.gpg` | O | | -| `` | `` | O | | -| `` | `` | R | | -| `` | `google-chrom.list` | R | | -| `` | `` | R | | -| `` | `` | R | | -| `` | `` | R | | -| `` | `` | R | | +| Tag | Example | Required/Optional | Notes | +|:-----------------------------------------|:------------------------------------------|:-----------------:|:------| +| `` | `` | R | | +| `` | `` | R | | +| `` | `source` | R | | +| `` | `` | R | | +| `` | `` | R | | +| `` | `` | O | | +| `` | `google-chrome.gpg` | O | | +| `` | `` | O | | +| `` | `` | R | | +| `` | `google-chrome.list` | R | | +| `` | `` | R | | +| `` | `` | R | | +| `` | `` | R | | +| `` | `` | R | | @@ -1044,7 +1097,7 @@ The query command can be used to gather information about the system and the Vis - google-chrome.list + google-chrome.sources diff --git a/inbc-program/tests/unit/test_source_app_parser.py b/inbc-program/tests/unit/test_source_app_parser.py index 547f2f1d7..c16d98595 100644 --- a/inbc-program/tests/unit/test_source_app_parser.py +++ b/inbc-program/tests/unit/test_source_app_parser.py @@ -82,7 +82,7 @@ def test_create_add_deb_822_format_manifest_successfully(self, m_connect): 'URIs: https://dl-ssl.google.com/linux/linux_signing_key.pub', 'Suites: stable', 'Components: main', - '--filename', 'intel-gpu-jammy.list']) + '--filename', 'google-chrome.sources']) Inbc(p, 'source', False) expected = 'source' \ 'X-Repolib-Name: Google Chrome' \ @@ -91,7 +91,7 @@ def test_create_add_deb_822_format_manifest_successfully(self, m_connect): 'URIs: https://dl-ssl.google.com/linux/linux_signing_key.pub' \ 'Suites: stable' \ 'Components: main' \ - 'intel-gpu-jammy.list' + 'google-chrome.sources' self.assertEqual(p.func(p), expected) @patch('inbm_lib.mqttclient.mqtt.mqtt.Client.connect') diff --git a/inbm/dispatcher-agent/fpm-template/usr/share/dispatcher-agent/manifest_schema.xsd b/inbm/dispatcher-agent/fpm-template/usr/share/dispatcher-agent/manifest_schema.xsd index a8ea29ac0..36ce3c38a 100644 --- a/inbm/dispatcher-agent/fpm-template/usr/share/dispatcher-agent/manifest_schema.xsd +++ b/inbm/dispatcher-agent/fpm-template/usr/share/dispatcher-agent/manifest_schema.xsd @@ -333,7 +333,7 @@ - + @@ -353,7 +353,7 @@ - + diff --git a/inbm/dispatcher-agent/tests/unit/source/test_ubuntu_source_cmd.py b/inbm/dispatcher-agent/tests/unit/source/test_ubuntu_source_cmd.py index 60e500191..933e37379 100644 --- a/inbm/dispatcher-agent/tests/unit/source/test_ubuntu_source_cmd.py +++ b/inbm/dispatcher-agent/tests/unit/source/test_ubuntu_source_cmd.py @@ -210,7 +210,7 @@ def test_add_app_with_gpg_key_successfully(self): def test_add_app_deb_822_format_successfully(self): try: params = ApplicationAddSourceParameters( - file_name="intel-gpu-jammy.list", + file_name="google-chrome.sources", sources="X-Repolib-Name: Google Chrome" "Enabled: yes" "Types: deb"