|
18 | 18 | import humanize
|
19 | 19 | import yaml
|
20 | 20 | from colorama import Fore
|
21 |
| -from invoke import run, task |
| 21 | +from invoke import run |
22 | 22 | from invoke.exceptions import UnexpectedExit
|
23 | 23 |
|
24 | 24 | from gitops.common.app import App
|
@@ -61,7 +61,7 @@ def list_backups(product, prefix):
|
61 | 61 |
|
62 | 62 |
|
63 | 63 | def download_backup(product, prefix, index, path=None, datestamp=False):
|
64 |
| - s3 = get_client("s3") |
| 64 | + s3 = boto3.client("s3") |
65 | 65 | key = get_backups(product, prefix)[int(index) - 1][3]
|
66 | 66 | url = s3.generate_presigned_url("get_object", Params={"Bucket": "uptick-backups", "Key": key})
|
67 | 67 | name = prefix
|
@@ -105,22 +105,6 @@ def copy_db(ctx, source, destination, context=""):
|
105 | 105 | )
|
106 | 106 |
|
107 | 107 |
|
108 |
| -@task |
109 |
| -def create_backup_secrets(ctx, context="", namespace="workforce"): |
110 |
| - """Create backup job secrets. |
111 |
| -
|
112 |
| - Before running backups certain secret keys need to be available to |
113 |
| - the job. This creates the secrets on the cluster. |
114 |
| - """ |
115 |
| - run( |
116 |
| - "kubectl create secret generic backups-secrets" |
117 |
| - f" --context {context}" |
118 |
| - f" -n {namespace}" |
119 |
| - " --from-literal=AWS_ACCESS_KEY_ID={get_secret('BACKUPS_AWS_ACCESS_KEY_ID')}" |
120 |
| - " --from-literal=AWS_SECRET_ACCESS_KEY={get_secret('BACKUPS_AWS_SECRET_ACCESS_KEY')}" |
121 |
| - ) |
122 |
| - |
123 |
| - |
124 | 108 | def get_backups(product, prefix):
|
125 | 109 | s3 = boto3.resource("s3")
|
126 | 110 | bucket = s3.Bucket("uptick-backups")
|
@@ -153,13 +137,6 @@ def get_secret(name, base64=False):
|
153 | 137 | return value
|
154 | 138 |
|
155 | 139 |
|
156 |
| -def get_client(name): |
157 |
| - return boto3.Session( |
158 |
| - aws_access_key_id=os.environ["BACKUPS_AWS_ACCESS_KEY_ID"], |
159 |
| - aws_secret_access_key=os.environ["BACKUPS_AWS_SECRET_ACCESS_KEY"], |
160 |
| - ).client(name) |
161 |
| - |
162 |
| - |
163 | 140 | @contextmanager
|
164 | 141 | def run_wrapper(intro):
|
165 | 142 | print(intro, end="", flush=True)
|
|
0 commit comments