Skip to content

Commit

Permalink
AL-5634: Integrate shared library into CLBS and ALBS
Browse files Browse the repository at this point in the history
  • Loading branch information
maccelf committed Dec 6, 2024
1 parent 61b1443 commit e8f4aa2
Show file tree
Hide file tree
Showing 13 changed files with 109 additions and 1,452 deletions.
22 changes: 14 additions & 8 deletions almalinux_sign_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,33 @@
# created: 2018-03-31

"""
CloudLinux Build System builds sign node.
AlmaLinux Build System builds sign node.
"""

import argparse
import logging
import sys

import sentry_sdk
from common_library.errors import ConfigurationError
from common_library.utils.file_utils import clean_dir, safe_mkdir
from common_library.utils.pgp_utils import PGPPasswordDB, init_gpg

from sign_node.config import SignNodeConfig
from sign_node.errors import ConfigurationError
from sign_node.signer import Signer
from sign_node.utils.config import locate_config_file
from sign_node.utils.file_utils import clean_dir, safe_mkdir
from sign_node.utils.pgp_utils import PGPPasswordDB, init_gpg


def init_arg_parser():
parser = argparse.ArgumentParser(
prog="sign_node", description="CloudLinux Build System builds sign node"
prog="sign_node", description="AlmaLinux Build System builds sign node"
)
parser.add_argument("-c", "--config", help="configuration file path")
parser.add_argument(
"-v", "--verbose", action="store_true", help="enable additional debug output"
"-v",
"--verbose",
action="store_true",
help="enable additional debug output",
)
return parser

Expand Down Expand Up @@ -70,7 +73,10 @@ def main():
logger = init_logger(args.verbose)
try:
config_file = locate_config_file('sign_node', args.config)
logger.debug("Loading %s", config_file if config_file else 'default configuration')
logger.debug(
"Loading %s",
config_file if config_file else 'default configuration',
)
config = SignNodeConfig(config_file)
except ValueError as e:
args_parser.error('Configuration error: {0}'.format(e))
Expand All @@ -82,7 +88,7 @@ def main():
key_ids_from_config=config.pgp_keys.copy(),
is_community_sign_node=config.is_community_sign_node,
development_mode=config.development_mode,
development_password=config.dev_pgp_key_password
development_password=config.dev_pgp_key_password,
)
try:
password_db.ask_for_passwords()
Expand Down
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@ cerberus==1.3.5
validators==0.34.0
pycurl==7.45.3
pyyaml==6.0.2
pydantic==2.9.2
pexpect==4.9.0
python-gnupg==0.5.3
sentry-sdk==2.18.0
websocket-client==1.8.0
# Pin cryptography module for now. More info at:
# https://jasonralph.org/?p=997
cryptography==43.0.3
pgpy==0.6.0
git+https://github.com/AlmaLinux/[email protected]#egg=immudb_wrapper
git+https://github.com/AlmaLinux/[email protected]@egg=common_library[signer]
2 changes: 1 addition & 1 deletion sign_node/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
# created: 2018-03-31

"""
CloudLinux Build System builds sign node module.
AlmaLinux Build System builds sign node module.
"""
28 changes: 15 additions & 13 deletions sign_node/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,26 @@
# created: 2018-03-31

"""
CloudLinux Build System builds sign node configuration storage.
AlmaLinux Build System builds sign node configuration storage.
"""

from .utils.config import BaseConfig
from .utils.file_utils import normalize_path

__all__ = ["SignNodeConfig"]
from common_library.utils.file_utils import normalize_path
from common_library.constants import DEFAULT_PARALLEL_FILE_UPLOAD_SIZE

from .utils.config import BaseConfig

DEFAULT_MASTER_URL = 'http://web_server:8000/api/v1/'
DEFAULT_WS_MASTER_URL = 'ws://web_server:8000/api/v1/'
DEFAULT_PULP_HOST = "http://pulp"
DEFAULT_PULP_USER = "pulp"
DEFAULT_PULP_PASSWORD = "test_pwd"
DEFAULT_PULP_CHUNK_SIZE = 8388608 # 8 MiB
# Max file size to allow parallel upload for
DEFAULT_PARALLEL_FILE_UPLOAD_SIZE = 52428800 # 500 MB
DEFAULT_PGP_PASSWORD = "test_pwd"
DEFAULT_SENTRY_DSN = ""
DEFAULT_SENTRY_ENVIRONMENT = "dev"
DEFAULT_SENTRY_TRACES_SAMPLE_RATE = 0.2
DEFAULT_JWT_TOKEN = "test_jwt"

COMMUNITY_KEY_SUFFIX = 'ALBS community repo'

GPG_SCENARIO_TEMPLATE = (
'%no-protection\n'
'Key-Type: RSA\n'
Expand Down Expand Up @@ -83,13 +78,19 @@ def __init__(self, config_file=None, **cmd_args):
"node_id": {"type": "string", "required": True},
"master_url": {"type": "string", "required": True},
"ws_master_url": {"type": "string", "required": True},
"working_dir": {"type": "string", "required": True,
"coerce": normalize_path},
"working_dir": {
"type": "string",
"required": True,
"coerce": normalize_path,
},
"pulp_host": {"type": "string", "nullable": False},
"pulp_user": {"type": "string", "nullable": False},
"pulp_password": {"type": "string", "nullable": False},
"pulp_chunk_size": {"type": "integer", "nullable": False},
"parallel_upload_file_size": {"type": "integer", "nullable": False},
"parallel_upload_file_size": {
"type": "integer",
"nullable": False,
},
"jwt_token": {"type": "string", "required": True},
"dev_pgp_key_password": {"type": "string", "nullable": False},
"sentry_dsn": {"type": "string", "nullable": True},
Expand All @@ -101,7 +102,8 @@ def __init__(self, config_file=None, **cmd_args):
'immudb_address': {'type': 'string', 'nullable': True},
'immudb_public_key_file': {'type': 'string', 'nullable': True},
'files_sign_cert_path': {
'type': 'string', 'required': False,
'type': 'string',
'required': False,
'coerce': normalize_path,
},
}
Expand Down
96 changes: 0 additions & 96 deletions sign_node/errors.py

This file was deleted.

18 changes: 0 additions & 18 deletions sign_node/models.py

This file was deleted.

87 changes: 0 additions & 87 deletions sign_node/package_sign.py

This file was deleted.

Loading

0 comments on commit e8f4aa2

Please sign in to comment.