Skip to content

Commit

Permalink
Rename support package to support packet
Browse files Browse the repository at this point in the history
  • Loading branch information
ifoukarakis committed Aug 20, 2024
1 parent 0319506 commit 2c21af4
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
18 changes: 9 additions & 9 deletions tests/utils/packets/test_loaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from utils.packets.loaders import (
load_metadata,
load_support_package_file,
load_support_packet_file,
load_support_packet_info,
load_user_survey,
load_user_survey_package,
Expand Down Expand Up @@ -252,7 +252,7 @@ def test_load_support_packet_full():
with open(SUPPORT_DIR / 'full.yaml', 'r') as fp:
sp = load_support_packet_info(fp)

# THEN: expect support package to be loaded correctly
# THEN: expect support packet to be loaded correctly
assert sp.license_to == 'Mattermost'
assert sp.server_os == 'linux'
assert sp.server_architecture == 'amd64'
Expand Down Expand Up @@ -308,13 +308,13 @@ def test_support_packet_invalid():


#
# Full loader for support package v1
# Full loader for support packet v1
#


def test_load_full_support_package_v1_with_metadata():
# WHEN: attempt to load a valid support package
metadata, sp = load_support_package_file(SUPPORT_DIR / 'valid_with_metadata.zip')
def test_load_full_support_packet_v1_with_metadata():
# WHEN: attempt to load a valid support packet
metadata, sp = load_support_packet_file(SUPPORT_DIR / 'valid_with_metadata.zip')

# THEN: expect metadata to be loaded correctly
assert metadata == SupportPacketMetadata(
Expand All @@ -334,9 +334,9 @@ def test_load_full_support_package_v1_with_metadata():
assert sp.build_hash == '0bc2ddd42375a75ab14e63f038165150d4f07659'


def test_load_full_support_package_v1_without_metadata():
# WHEN: attempt to load a valid support package
metadata, sp = load_support_package_file(SUPPORT_DIR / 'valid_without_metadata.zip')
def test_load_full_support_packet_v1_without_metadata():
# WHEN: attempt to load a valid support packet
metadata, sp = load_support_packet_file(SUPPORT_DIR / 'valid_without_metadata.zip')

# THEN: expect metadata to be loaded correctly
assert metadata is None
Expand Down
6 changes: 3 additions & 3 deletions utils/packets/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import click

from utils.helpers import initialize_cli_logging
from utils.packets.service import ingest_support_package, ingest_survey_packet
from utils.packets.service import ingest_support_packet, ingest_survey_packet

initialize_cli_logging(logging.INFO, 'stderr')

Expand Down Expand Up @@ -34,8 +34,8 @@ def support_v1(
input: click.Path,
) -> None:
"""
Ingest a support package using the original support package specification.
Ingest a support packet using the original support package specification.
:param input: The zip file with the support package.
"""
ingest_support_package(input)
ingest_support_packet(input)
2 changes: 1 addition & 1 deletion utils/packets/loaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def load_support_packet_info(metadata_file: IO) -> SupportPacketV1:
return SupportPacketV1(**data)


def load_support_package_file(
def load_support_packet_file(
support_packet_zip_file: str | os.PathLike,
) -> Tuple[SupportPacketMetadata, SupportPacketV1]:
with ZipFile(support_packet_zip_file, 'r') as zipfile:
Expand Down
10 changes: 5 additions & 5 deletions utils/packets/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from click import ClickException

from utils.packets.loaders import UserSurveyFixedColumns, load_support_package_file, load_user_survey_package
from utils.packets.loaders import UserSurveyFixedColumns, load_support_packet_file, load_user_survey_package

logger = getLogger(__name__)

Expand All @@ -27,20 +27,20 @@ def ingest_survey_packet(survey_packet: str | os.PathLike):
raise ClickException(f'Error loading survey packet: {e}')


def ingest_support_package(support_package: str | os.PathLike):
def ingest_support_packet(support_packet: str | os.PathLike):
"""
Load support package data and metadata.
:support_package: The path to the survey packet file.
"""
try:
metadata, sp = load_support_package_file(support_package)
logger.info('Loaded survey packet')
metadata, sp = load_support_packet_file(support_packet)
logger.info('Loaded support packet')
if metadata:
logger.info(f' -> Server ID: {metadata.server_id}')
logger.info(f' -> License ID: {metadata.license_id}')
else:
logger.info('Support package does not include metadata file')
logger.info('Support packet does not include metadata file')
logger.info('')
logger.info(f' Server: {sp.server_version} ({sp.server_os} {sp.server_architecture})')
logger.info(f' Database: {sp.database_type} {sp.database_version} (schema {sp.database_schema_version})')
Expand Down

0 comments on commit 2c21af4

Please sign in to comment.