forked from hitachienergy/epiphany
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement new download requirements script (hitachienergy#805)
* rsync added to the Dockerfile
- Loading branch information
Showing
35 changed files
with
1,442 additions
and
739 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 0 additions & 5 deletions
5
ansible/playbooks/roles/repository/files/client/Debian/enable-system-repos.sh
This file was deleted.
Oops, something went wrong.
41 changes: 41 additions & 0 deletions
41
ansible/playbooks/roles/repository/files/download-requirements/download-requirements.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/usr/bin/python3 | ||
import datetime | ||
import logging | ||
import sys | ||
from os import getuid | ||
from typing import Dict, List | ||
|
||
from src.config import Config, OSType | ||
from src.error import CriticalError | ||
from src.mode.base_mode import BaseMode | ||
from src.mode.debian_family_mode import DebianFamilyMode | ||
from src.mode.red_hat_family_mode import RedHatFamilyMode | ||
|
||
|
||
MODES: Dict[OSType, BaseMode] = { | ||
OSType.Ubuntu: DebianFamilyMode, | ||
OSType.RedHat: RedHatFamilyMode, | ||
OSType.CentOS: RedHatFamilyMode | ||
} | ||
|
||
|
||
def main(argv: List[str]) -> int: | ||
try: | ||
time_begin = datetime.datetime.now() | ||
if getuid() != 0: | ||
print('Error: Needs to be run as root!') | ||
return 1 | ||
|
||
config = Config(argv) | ||
|
||
MODES[config.os_type](config).run() | ||
|
||
time_end = time_begin - datetime.datetime.now() | ||
logging.info(f'Total execution time: {str(time_end).split(".")[0]}') | ||
except CriticalError: | ||
return 1 | ||
|
||
return 0 | ||
|
||
if __name__ == '__main__': | ||
sys.exit(main(sys.argv)) |
16 changes: 16 additions & 0 deletions
16
ansible/playbooks/roles/repository/files/download-requirements/repositories/repositories.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from typing import Dict, List | ||
|
||
from repositories.ubuntu import REPOSITORIES_X86_64 as Ubuntu_X86_64 | ||
from src.config import OSArch, OSType | ||
|
||
|
||
REPOSITORIES: Dict[OSArch, Dict[OSType, Dict[str, List]]] = { | ||
OSArch.X86_64: { | ||
OSType.CentOS: {}, | ||
OSType.RedHat: {}, | ||
OSType.Ubuntu: Ubuntu_X86_64 | ||
}, | ||
OSArch.ARM64: { | ||
OSType.CentOS: {} | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
ansible/playbooks/roles/repository/files/download-requirements/repositories/ubuntu.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
from pathlib import Path | ||
from typing import Dict | ||
|
||
|
||
class Repo: | ||
def __init__(self, key: str, content: str, path: Path): | ||
self.key: str = key | ||
self.content: str = content | ||
self.path: Path = path | ||
|
||
|
||
REPOSITORIES_X86_64: Dict[str, Repo] = { | ||
'elastic_6': Repo('https://artifacts.elastic.co/GPG-KEY-elasticsearch', | ||
'deb https://artifacts.elastic.co/packages/oss-6.x/apt stable main', | ||
Path('/etc/apt/sources.list.d/elastic-6.x.list')), | ||
|
||
'kubernetes': Repo('https://packages.cloud.google.com/apt/doc/apt-key.gpg', | ||
'deb http://apt.kubernetes.io/ kubernetes-xenial main', | ||
Path('/etc/apt/sources.list.d/kubernetes.list')), | ||
|
||
'erlang_solutions': Repo('https://packages.erlang-solutions.com/ubuntu/erlang_solutions.asc', | ||
'deb https://packages.erlang-solutions.com/ubuntu bionic contrib', | ||
Path('/etc/apt/sources.list.d/erlang-23.x.list')), | ||
|
||
'rabbitmq_server': Repo('https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey', | ||
'deb https://packagecloud.io/rabbitmq/rabbitmq-server/ubuntu bionic main', | ||
Path('/etc/apt/sources.list.d/rabbitmq.list')), | ||
|
||
'docker_ce': Repo('https://download.docker.com/linux/ubuntu/gpg', | ||
'deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable', | ||
Path('/etc/apt/sources.list.d/docker-ce.list')), | ||
|
||
'elastic_7': Repo('https://artifacts.elastic.co/GPG-KEY-elasticsearch', | ||
'deb https://artifacts.elastic.co/packages/oss-7.x/apt stable main', | ||
Path('/etc/apt/sources.list.d/elastic-7.x.list')), | ||
|
||
'opendistroforelasticsearch': Repo('https://d3g5vo6xdbdb9a.cloudfront.net/GPG-KEY-opendistroforelasticsearch', | ||
'deb https://d3g5vo6xdbdb9a.cloudfront.net/apt stable main', | ||
Path('/etc/apt/sources.list.d/opendistroforelasticsearch.list')), | ||
|
||
'postgresql': Repo('https://www.postgresql.org/media/keys/ACCC4CF8.asc', | ||
'deb http://apt.postgresql.org/pub/repos/apt bionic-pgdg main', | ||
Path('/etc/apt/sources.list.d/pgdg.list')), | ||
|
||
# Historical packages from apt.postgresql.org | ||
'postgresql-archive': Repo('https://www.postgresql.org/media/keys/ACCC4CF8.asc', | ||
'deb http://apt-archive.postgresql.org/pub/repos/apt bionic-pgdg-archive main', | ||
Path('/etc/apt/sources.list.d/pgdg-archive.list')), | ||
|
||
# Provides repmgr | ||
'2ndquadrant': Repo('https://dl.2ndquadrant.com/gpg-key.asc', | ||
'deb https://dl.2ndquadrant.com/default/release/apt bionic-2ndquadrant main', | ||
Path('/etc/apt/sources.list.d/2ndquadrant-dl-default-release.list')) | ||
} |
Empty file.
Empty file.
15 changes: 15 additions & 0 deletions
15
ansible/playbooks/roles/repository/files/download-requirements/requirements/requirements.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from typing import Dict, List | ||
from src.config import OSArch, OSType | ||
from requirements.ubuntu import REQUIREMENTS_X86_64 as Ubuntu_X86_64 | ||
|
||
|
||
REQUIREMENTS: Dict[OSArch, Dict[OSType, Dict[str, List]]] = { | ||
OSArch.X86_64: { | ||
OSType.CentOS: {}, | ||
OSType.RedHat: {}, | ||
OSType.Ubuntu: Ubuntu_X86_64 | ||
}, | ||
OSArch.ARM64: { | ||
OSType.CentOS: {} | ||
} | ||
} |
Oops, something went wrong.