snapctl 1.7.0__tar.gz → 1.7.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {snapctl-1.7.0 → snapctl-1.7.2}/PKG-INFO +1 -1
- {snapctl-1.7.0 → snapctl-1.7.2}/pyproject.toml +1 -1
- {snapctl-1.7.0 → snapctl-1.7.2}/snapctl/commands/application.py +3 -0
- {snapctl-1.7.0 → snapctl-1.7.2}/snapctl/commands/byogs.py +19 -11
- {snapctl-1.7.0 → snapctl-1.7.2}/snapctl/commands/byosnap.py +26 -12
- {snapctl-1.7.0 → snapctl-1.7.2}/snapctl/commands/byows.py +4 -0
- {snapctl-1.7.0 → snapctl-1.7.2}/snapctl/commands/game.py +3 -0
- {snapctl-1.7.0 → snapctl-1.7.2}/snapctl/commands/generate.py +2 -0
- {snapctl-1.7.0 → snapctl-1.7.2}/snapctl/commands/snapend.py +10 -0
- {snapctl-1.7.0 → snapctl-1.7.2}/snapctl/commands/snapend_manifest.py +9 -1
- {snapctl-1.7.0 → snapctl-1.7.2}/snapctl/commands/snaps.py +3 -1
- {snapctl-1.7.0 → snapctl-1.7.2}/snapctl/config/constants.py +1 -1
- snapctl-1.7.2/snapctl/data/releases/1.7.1.md +5 -0
- snapctl-1.7.2/snapctl/data/releases/1.7.2.md +5 -0
- {snapctl-1.7.0 → snapctl-1.7.2}/snapctl/main.py +6 -5
- snapctl-1.7.2/snapctl/utils/console.py +4 -0
- {snapctl-1.7.0 → snapctl-1.7.2}/snapctl/utils/echo.py +6 -13
- {snapctl-1.7.0 → snapctl-1.7.2}/snapctl/utils/helper.py +20 -7
- {snapctl-1.7.0 → snapctl-1.7.2}/LICENSE +0 -0
- {snapctl-1.7.0 → snapctl-1.7.2}/README.md +0 -0
- {snapctl-1.7.0 → snapctl-1.7.2}/snapctl/__init__.py +0 -0
- {snapctl-1.7.0 → snapctl-1.7.2}/snapctl/__main__.py +0 -0
- {snapctl-1.7.0 → snapctl-1.7.2}/snapctl/commands/__init__.py +0 -0
- {snapctl-1.7.0 → snapctl-1.7.2}/snapctl/commands/release_notes.py +0 -0
- {snapctl-1.7.0 → snapctl-1.7.2}/snapctl/config/__init__.py +0 -0
- {snapctl-1.7.0 → snapctl-1.7.2}/snapctl/config/app.py +0 -0
- {snapctl-1.7.0 → snapctl-1.7.2}/snapctl/config/endpoints.py +0 -0
- {snapctl-1.7.0 → snapctl-1.7.2}/snapctl/config/hashes.py +0 -0
- {snapctl-1.7.0 → snapctl-1.7.2}/snapctl/data/__init__.py +0 -0
- {snapctl-1.7.0 → snapctl-1.7.2}/snapctl/data/profiles/__init__.py +0 -0
- {snapctl-1.7.0 → snapctl-1.7.2}/snapctl/data/profiles/snapser-byosnap-profile.json +0 -0
- {snapctl-1.7.0 → snapctl-1.7.2}/snapctl/data/profiles/snapser-byosnap-profile.yaml +0 -0
- {snapctl-1.7.0 → snapctl-1.7.2}/snapctl/data/profiles/snapser-byosnap-profile.yml +0 -0
- {snapctl-1.7.0 → snapctl-1.7.2}/snapctl/data/releases/1.0.0.md +0 -0
- {snapctl-1.7.0 → snapctl-1.7.2}/snapctl/data/releases/1.0.2.md +0 -0
- {snapctl-1.7.0 → snapctl-1.7.2}/snapctl/data/releases/1.0.3.md +0 -0
- {snapctl-1.7.0 → snapctl-1.7.2}/snapctl/data/releases/1.0.4.md +0 -0
- {snapctl-1.7.0 → snapctl-1.7.2}/snapctl/data/releases/1.1.0.md +0 -0
- {snapctl-1.7.0 → snapctl-1.7.2}/snapctl/data/releases/1.1.2.md +0 -0
- {snapctl-1.7.0 → snapctl-1.7.2}/snapctl/data/releases/1.1.3.md +0 -0
- {snapctl-1.7.0 → snapctl-1.7.2}/snapctl/data/releases/1.1.4.md +0 -0
- {snapctl-1.7.0 → snapctl-1.7.2}/snapctl/data/releases/1.1.5.md +0 -0
- {snapctl-1.7.0 → snapctl-1.7.2}/snapctl/data/releases/1.4.0.md +0 -0
- {snapctl-1.7.0 → snapctl-1.7.2}/snapctl/data/releases/1.4.1.md +0 -0
- {snapctl-1.7.0 → snapctl-1.7.2}/snapctl/data/releases/1.5.0.md +0 -0
- {snapctl-1.7.0 → snapctl-1.7.2}/snapctl/data/releases/1.6.0.md +0 -0
- {snapctl-1.7.0 → snapctl-1.7.2}/snapctl/data/releases/1.6.1.md +0 -0
- {snapctl-1.7.0 → snapctl-1.7.2}/snapctl/data/releases/1.6.2.md +0 -0
- {snapctl-1.7.0 → snapctl-1.7.2}/snapctl/data/releases/1.7.0.md +0 -0
- {snapctl-1.7.0 → snapctl-1.7.2}/snapctl/data/releases/__init__.py +0 -0
- {snapctl-1.7.0 → snapctl-1.7.2}/snapctl/tui/app.py +0 -0
- {snapctl-1.7.0 → snapctl-1.7.2}/snapctl/types/__init__.py +0 -0
- {snapctl-1.7.0 → snapctl-1.7.2}/snapctl/types/definitions.py +0 -0
- {snapctl-1.7.0 → snapctl-1.7.2}/snapctl/utils/__init__.py +0 -0
- {snapctl-1.7.0 → snapctl-1.7.2}/snapctl/utils/exceptions.py +0 -0
- {snapctl-1.7.0 → snapctl-1.7.2}/snapctl/utils/telemetry.py +0 -0
|
@@ -9,6 +9,7 @@ from snapctl.config.constants import SERVER_CALL_TIMEOUT, SNAPCTL_INPUT_ERROR, \
|
|
|
9
9
|
SNAPCTL_GAME_CREATE_ERROR, SNAPCTL_GAME_ENUMERATE_ERROR, \
|
|
10
10
|
HTTP_ERROR_DUPLICATE_GAME_NAME, SNAPCTL_GAME_CREATE_DUPLICATE_NAME_ERROR, \
|
|
11
11
|
HTTP_ERROR_GAME_LIMIT_REACHED, SNAPCTL_GAME_CREATE_LIMIT_ERROR
|
|
12
|
+
from snapctl.utils.console import err_console
|
|
12
13
|
from snapctl.utils.helper import snapctl_error, snapctl_success
|
|
13
14
|
|
|
14
15
|
|
|
@@ -58,6 +59,7 @@ class Application:
|
|
|
58
59
|
SpinnerColumn(),
|
|
59
60
|
TextColumn("[progress.description]{task.description}"),
|
|
60
61
|
transient=True,
|
|
62
|
+
console=err_console
|
|
61
63
|
)
|
|
62
64
|
progress.start()
|
|
63
65
|
progress.add_task(
|
|
@@ -107,6 +109,7 @@ class Application:
|
|
|
107
109
|
SpinnerColumn(),
|
|
108
110
|
TextColumn("[progress.description]{task.description}"),
|
|
109
111
|
transient=True,
|
|
112
|
+
console=err_console
|
|
110
113
|
)
|
|
111
114
|
progress.start()
|
|
112
115
|
progress.add_task(
|
|
@@ -8,6 +8,7 @@ import json
|
|
|
8
8
|
import subprocess
|
|
9
9
|
import time
|
|
10
10
|
import platform as sys_platform
|
|
11
|
+
import sys
|
|
11
12
|
from sys import platform
|
|
12
13
|
from typing import Union, List
|
|
13
14
|
|
|
@@ -21,6 +22,7 @@ from snapctl.config.constants import SNAPCTL_BYOGS_DEPENDENCY_MISSING, \
|
|
|
21
22
|
from snapctl.utils.helper import get_composite_token, snapctl_error, snapctl_success, \
|
|
22
23
|
check_dockerfile_architecture, check_use_containerd_snapshotter
|
|
23
24
|
from snapctl.utils.echo import info, warning
|
|
25
|
+
from snapctl.utils.console import err_console
|
|
24
26
|
|
|
25
27
|
|
|
26
28
|
class ByoGs:
|
|
@@ -123,6 +125,7 @@ class ByoGs:
|
|
|
123
125
|
SpinnerColumn(),
|
|
124
126
|
TextColumn("[progress.description]{task.description}"),
|
|
125
127
|
transient=True,
|
|
128
|
+
console=err_console
|
|
126
129
|
)
|
|
127
130
|
progress.start()
|
|
128
131
|
progress.add_task(
|
|
@@ -132,7 +135,7 @@ class ByoGs:
|
|
|
132
135
|
# Check dependencies
|
|
133
136
|
result = subprocess.run([
|
|
134
137
|
"docker", "info"
|
|
135
|
-
], stdout=
|
|
138
|
+
], stdout=sys.stderr, stderr=sys.stderr, check=False)
|
|
136
139
|
if not result.returncode:
|
|
137
140
|
return snapctl_success(
|
|
138
141
|
message='BYOGS dependencies verified',
|
|
@@ -154,6 +157,7 @@ class ByoGs:
|
|
|
154
157
|
SpinnerColumn(),
|
|
155
158
|
TextColumn("[progress.description]{task.description}"),
|
|
156
159
|
transient=True,
|
|
160
|
+
console=err_console
|
|
157
161
|
)
|
|
158
162
|
progress.start()
|
|
159
163
|
progress.add_task(
|
|
@@ -183,12 +187,12 @@ class ByoGs:
|
|
|
183
187
|
response = subprocess.run([
|
|
184
188
|
'docker', 'login', '--username', ecr_repo_username,
|
|
185
189
|
'--password', ecr_repo_token, ecr_repo_url
|
|
186
|
-
], shell=True, stdout=
|
|
190
|
+
], shell=True, stdout=sys.stderr, stderr=sys.stderr, check=False)
|
|
187
191
|
else:
|
|
188
192
|
response = subprocess.run([
|
|
189
193
|
f'echo "{ecr_repo_token}" | docker login ' +
|
|
190
194
|
f'--username {ecr_repo_username} --password-stdin {ecr_repo_url}'
|
|
191
|
-
], shell=True, stdout=
|
|
195
|
+
], shell=True, stdout=sys.stderr, stderr=sys.stderr, check=False)
|
|
192
196
|
if not response.returncode:
|
|
193
197
|
return snapctl_success(
|
|
194
198
|
message='BYOGS ECR login successful', progress=progress, no_exit=True)
|
|
@@ -208,6 +212,7 @@ class ByoGs:
|
|
|
208
212
|
SpinnerColumn(),
|
|
209
213
|
TextColumn("[progress.description]{task.description}"),
|
|
210
214
|
transient=True,
|
|
215
|
+
console=err_console
|
|
211
216
|
)
|
|
212
217
|
progress.start()
|
|
213
218
|
progress.add_task(
|
|
@@ -242,7 +247,7 @@ class ByoGs:
|
|
|
242
247
|
*secret_args,
|
|
243
248
|
'-t', self.tag,
|
|
244
249
|
'-f', self.docker_path_filename, self.path
|
|
245
|
-
], shell=True, check=False, env=env)
|
|
250
|
+
], shell=True, check=False, env=env, stdout=sys.stderr, stderr=sys.stderr)
|
|
246
251
|
# stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT)
|
|
247
252
|
else:
|
|
248
253
|
# Build the secret string for shell=True: "--secret x --secret y"
|
|
@@ -255,7 +260,7 @@ class ByoGs:
|
|
|
255
260
|
"docker build --load --platform " +
|
|
256
261
|
f"{build_platform} {secret_str} -t {self.tag} " +
|
|
257
262
|
f"-f {self.docker_path_filename} {self.path}"
|
|
258
|
-
], shell=True, check=False, env=env)
|
|
263
|
+
], shell=True, check=False, env=env, stdout=sys.stderr, stderr=sys.stderr)
|
|
259
264
|
# stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT)
|
|
260
265
|
if not response.returncode:
|
|
261
266
|
return snapctl_success(
|
|
@@ -277,6 +282,7 @@ class ByoGs:
|
|
|
277
282
|
SpinnerColumn(),
|
|
278
283
|
TextColumn("[progress.description]{task.description}"),
|
|
279
284
|
transient=True,
|
|
285
|
+
console=err_console
|
|
280
286
|
)
|
|
281
287
|
progress.start()
|
|
282
288
|
progress.add_task(
|
|
@@ -289,11 +295,11 @@ class ByoGs:
|
|
|
289
295
|
if platform == "win32":
|
|
290
296
|
response = subprocess.run([
|
|
291
297
|
'docker', 'tag', self.tag, full_ecr_repo_url
|
|
292
|
-
], shell=True, stdout=
|
|
298
|
+
], shell=True, stdout=sys.stderr, stderr=sys.stderr, check=False)
|
|
293
299
|
else:
|
|
294
300
|
response = subprocess.run([
|
|
295
301
|
f"docker tag {self.tag} {full_ecr_repo_url}"
|
|
296
|
-
], shell=True, stdout=
|
|
302
|
+
], shell=True, stdout=sys.stderr, stderr=sys.stderr, check=False)
|
|
297
303
|
if not response.returncode:
|
|
298
304
|
return snapctl_success(
|
|
299
305
|
message='BYOGS tag successful', progress=progress, no_exit=True)
|
|
@@ -311,6 +317,7 @@ class ByoGs:
|
|
|
311
317
|
SpinnerColumn(),
|
|
312
318
|
TextColumn("[progress.description]{task.description}"),
|
|
313
319
|
transient=True,
|
|
320
|
+
console=err_console
|
|
314
321
|
)
|
|
315
322
|
progress.start()
|
|
316
323
|
progress.add_task(
|
|
@@ -323,12 +330,12 @@ class ByoGs:
|
|
|
323
330
|
if platform == "win32":
|
|
324
331
|
response = subprocess.run([
|
|
325
332
|
'docker', 'push', full_ecr_repo_url
|
|
326
|
-
], shell=True, check=False)
|
|
333
|
+
], shell=True, check=False, stdout=sys.stderr, stderr=sys.stderr)
|
|
327
334
|
# stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT)
|
|
328
335
|
else:
|
|
329
336
|
response = subprocess.run([
|
|
330
337
|
f"docker push {full_ecr_repo_url}"
|
|
331
|
-
], shell=True, check=False)
|
|
338
|
+
], shell=True, check=False, stdout=sys.stderr, stderr=sys.stderr)
|
|
332
339
|
# stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT)
|
|
333
340
|
if not response.returncode:
|
|
334
341
|
return snapctl_success(
|
|
@@ -349,6 +356,7 @@ class ByoGs:
|
|
|
349
356
|
SpinnerColumn(),
|
|
350
357
|
TextColumn("[progress.description]{task.description}"),
|
|
351
358
|
transient=True,
|
|
359
|
+
console=err_console
|
|
352
360
|
)
|
|
353
361
|
progress.start()
|
|
354
362
|
progress.add_task(
|
|
@@ -360,12 +368,12 @@ class ByoGs:
|
|
|
360
368
|
# Perform the Docker logout
|
|
361
369
|
logout_response = subprocess.run(
|
|
362
370
|
['docker', 'logout', ecr_repo_url],
|
|
363
|
-
shell=True, check=False)
|
|
371
|
+
shell=True, check=False, stdout=sys.stderr, stderr=sys.stderr)
|
|
364
372
|
else:
|
|
365
373
|
# Perform the Docker logout
|
|
366
374
|
logout_response = subprocess.run([
|
|
367
375
|
f"docker logout {ecr_repo_url}"
|
|
368
|
-
], shell=True, check=False)
|
|
376
|
+
], shell=True, check=False, stdout=sys.stderr, stderr=sys.stderr)
|
|
369
377
|
if not logout_response.returncode:
|
|
370
378
|
return snapctl_success(
|
|
371
379
|
message='Cleanup complete',
|
|
@@ -9,6 +9,7 @@ import re
|
|
|
9
9
|
import time
|
|
10
10
|
import subprocess
|
|
11
11
|
import platform as sys_platform
|
|
12
|
+
import sys
|
|
12
13
|
from sys import platform
|
|
13
14
|
from typing import Union, List
|
|
14
15
|
import importlib.resources as pkg_resources
|
|
@@ -31,6 +32,7 @@ from snapctl.config.constants import HTTP_ERROR_SERVICE_VERSION_EXISTS, \
|
|
|
31
32
|
HTTP_ERROR_RESOURCE_NOT_FOUND, SNAPCTL_BYOSNAP_PUBLISH_ERROR, \
|
|
32
33
|
SNAPCTL_BYOSNAP_GENERATE_PROFILE_ERROR, SNAPCTL_CONFIGURATION_INCORRECT
|
|
33
34
|
from snapctl.utils.echo import info, warning, success
|
|
35
|
+
from snapctl.utils.console import err_console
|
|
34
36
|
from snapctl.utils.helper import get_composite_token, snapctl_error, snapctl_success, \
|
|
35
37
|
check_dockerfile_architecture, check_use_containerd_snapshotter
|
|
36
38
|
import snapctl.data.profiles
|
|
@@ -642,6 +644,7 @@ class ByoSnap:
|
|
|
642
644
|
SpinnerColumn(),
|
|
643
645
|
TextColumn("[progress.description]{task.description}"),
|
|
644
646
|
transient=True,
|
|
647
|
+
console=err_console
|
|
645
648
|
)
|
|
646
649
|
progress.start()
|
|
647
650
|
progress.add_task(
|
|
@@ -650,7 +653,7 @@ class ByoSnap:
|
|
|
650
653
|
# Check dependencies
|
|
651
654
|
result = subprocess.run([
|
|
652
655
|
"docker", "info"
|
|
653
|
-
], stdout=
|
|
656
|
+
], stdout=sys.stderr, stderr=sys.stderr, check=False)
|
|
654
657
|
if not result.returncode:
|
|
655
658
|
return snapctl_success(
|
|
656
659
|
message='BYOSnap dependencies verified',
|
|
@@ -676,6 +679,7 @@ class ByoSnap:
|
|
|
676
679
|
SpinnerColumn(),
|
|
677
680
|
TextColumn("[progress.description]{task.description}"),
|
|
678
681
|
transient=True,
|
|
682
|
+
console=err_console
|
|
679
683
|
)
|
|
680
684
|
progress.start()
|
|
681
685
|
progress.add_task(
|
|
@@ -705,12 +709,12 @@ class ByoSnap:
|
|
|
705
709
|
response = subprocess.run([
|
|
706
710
|
'docker', 'login', '--username', ecr_repo_username,
|
|
707
711
|
'--password', ecr_repo_token, ecr_repo_url
|
|
708
|
-
], shell=True, stdout=
|
|
712
|
+
], shell=True, stdout=sys.stderr, stderr=sys.stderr, check=False)
|
|
709
713
|
else:
|
|
710
714
|
response = subprocess.run([
|
|
711
715
|
f'echo "{ecr_repo_token}" | docker login ' +
|
|
712
716
|
f'--username {ecr_repo_username} --password-stdin {ecr_repo_url}'
|
|
713
|
-
], shell=True, stdout=
|
|
717
|
+
], shell=True, stdout=sys.stderr, stderr=sys.stderr, check=False)
|
|
714
718
|
if not response.returncode:
|
|
715
719
|
return snapctl_success(
|
|
716
720
|
message='BYOSnap ECR login successful',
|
|
@@ -739,6 +743,7 @@ class ByoSnap:
|
|
|
739
743
|
SpinnerColumn(),
|
|
740
744
|
TextColumn("[progress.description]{task.description}"),
|
|
741
745
|
transient=True,
|
|
746
|
+
console=err_console
|
|
742
747
|
)
|
|
743
748
|
progress.start()
|
|
744
749
|
progress.add_task(
|
|
@@ -768,7 +773,7 @@ class ByoSnap:
|
|
|
768
773
|
*secret_args,
|
|
769
774
|
'-t', self.remote_tag,
|
|
770
775
|
'-f', self.docker_path_filename, self.path
|
|
771
|
-
], shell=True, check=False, env=env)
|
|
776
|
+
], shell=True, check=False, env=env, stdout=sys.stderr, stderr=sys.stderr)
|
|
772
777
|
# stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT)
|
|
773
778
|
else:
|
|
774
779
|
# Build the secret string for shell=True: "--secret x --secret y"
|
|
@@ -781,7 +786,7 @@ class ByoSnap:
|
|
|
781
786
|
"docker build --load --platform " +
|
|
782
787
|
f"{build_platform} {secret_str} -t {self.remote_tag} " +
|
|
783
788
|
f"-f {self.docker_path_filename} {self.path}"
|
|
784
|
-
], shell=True, check=False, env=env)
|
|
789
|
+
], shell=True, check=False, env=env, stdout=sys.stderr, stderr=sys.stderr)
|
|
785
790
|
# stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT)
|
|
786
791
|
if not response.returncode:
|
|
787
792
|
return snapctl_success(
|
|
@@ -805,6 +810,7 @@ class ByoSnap:
|
|
|
805
810
|
SpinnerColumn(),
|
|
806
811
|
TextColumn("[progress.description]{task.description}"),
|
|
807
812
|
transient=True,
|
|
813
|
+
console=err_console
|
|
808
814
|
)
|
|
809
815
|
progress.start()
|
|
810
816
|
progress.add_task(
|
|
@@ -814,11 +820,11 @@ class ByoSnap:
|
|
|
814
820
|
if platform == "win32":
|
|
815
821
|
response = subprocess.run([
|
|
816
822
|
'docker', 'tag', self.tag, full_ecr_repo_url
|
|
817
|
-
], shell=True, stdout=
|
|
823
|
+
], shell=True, stdout=sys.stderr, stderr=sys.stderr, check=False)
|
|
818
824
|
else:
|
|
819
825
|
response = subprocess.run([
|
|
820
826
|
f"docker tag {self.tag} {full_ecr_repo_url}"
|
|
821
|
-
], shell=True, stdout=
|
|
827
|
+
], shell=True, stdout=sys.stderr, stderr=sys.stderr, check=False)
|
|
822
828
|
if not response.returncode:
|
|
823
829
|
return snapctl_success(
|
|
824
830
|
message='BYOSnap tag successful', progress=progress, no_exit=True)
|
|
@@ -840,6 +846,7 @@ class ByoSnap:
|
|
|
840
846
|
SpinnerColumn(),
|
|
841
847
|
TextColumn("[progress.description]{task.description}"),
|
|
842
848
|
transient=True,
|
|
849
|
+
console=err_console
|
|
843
850
|
)
|
|
844
851
|
progress.start()
|
|
845
852
|
progress.add_task(description='Pushing your snap...', total=None)
|
|
@@ -851,12 +858,12 @@ class ByoSnap:
|
|
|
851
858
|
if platform == "win32":
|
|
852
859
|
response = subprocess.run([
|
|
853
860
|
'docker', 'push', full_ecr_repo_url
|
|
854
|
-
], shell=True, check=False)
|
|
861
|
+
], shell=True, check=False, stdout=sys.stderr, stderr=sys.stderr)
|
|
855
862
|
# stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT)
|
|
856
863
|
else:
|
|
857
864
|
response = subprocess.run([
|
|
858
865
|
f"docker push {full_ecr_repo_url}"
|
|
859
|
-
], shell=True, check=False)
|
|
866
|
+
], shell=True, check=False, stdout=sys.stderr, stderr=sys.stderr)
|
|
860
867
|
# stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT)
|
|
861
868
|
if not response.returncode:
|
|
862
869
|
return snapctl_success(
|
|
@@ -876,6 +883,7 @@ class ByoSnap:
|
|
|
876
883
|
SpinnerColumn(),
|
|
877
884
|
TextColumn("[progress.description]{task.description}"),
|
|
878
885
|
transient=True,
|
|
886
|
+
console=err_console
|
|
879
887
|
)
|
|
880
888
|
progress.start()
|
|
881
889
|
progress.add_task(
|
|
@@ -885,12 +893,13 @@ class ByoSnap:
|
|
|
885
893
|
ecr_domain = self.token_parts[0].split('/')[0]
|
|
886
894
|
# Perform the Docker logout
|
|
887
895
|
if platform == "win32":
|
|
888
|
-
logout_response = subprocess.run(
|
|
889
|
-
|
|
896
|
+
logout_response = subprocess.run(
|
|
897
|
+
['docker', 'logout', ecr_domain], shell=True, check=False,
|
|
898
|
+
stdout=sys.stderr, stderr=sys.stderr)
|
|
890
899
|
else:
|
|
891
900
|
logout_response = subprocess.run([
|
|
892
901
|
f"docker logout {ecr_domain}"
|
|
893
|
-
], shell=True, check=False)
|
|
902
|
+
], shell=True, check=False, stdout=sys.stderr, stderr=sys.stderr)
|
|
894
903
|
if not logout_response.returncode:
|
|
895
904
|
return snapctl_success(
|
|
896
905
|
message='Cleanup complete.', progress=progress, no_exit=True)
|
|
@@ -1217,6 +1226,7 @@ class ByoSnap:
|
|
|
1217
1226
|
SpinnerColumn(),
|
|
1218
1227
|
TextColumn("[progress.description]{task.description}"),
|
|
1219
1228
|
transient=True,
|
|
1229
|
+
console=err_console
|
|
1220
1230
|
)
|
|
1221
1231
|
progress.start()
|
|
1222
1232
|
progress.add_task(
|
|
@@ -1366,6 +1376,7 @@ class ByoSnap:
|
|
|
1366
1376
|
SpinnerColumn(),
|
|
1367
1377
|
TextColumn("[progress.description]{task.description}"),
|
|
1368
1378
|
transient=True,
|
|
1379
|
+
console=err_console
|
|
1369
1380
|
)
|
|
1370
1381
|
progress.start()
|
|
1371
1382
|
progress.add_task(description='Creating your snap...', total=None)
|
|
@@ -1440,6 +1451,7 @@ class ByoSnap:
|
|
|
1440
1451
|
SpinnerColumn(),
|
|
1441
1452
|
TextColumn("[progress.description]{task.description}"),
|
|
1442
1453
|
transient=True,
|
|
1454
|
+
console=err_console
|
|
1443
1455
|
)
|
|
1444
1456
|
progress.start()
|
|
1445
1457
|
progress.add_task(
|
|
@@ -1526,6 +1538,7 @@ class ByoSnap:
|
|
|
1526
1538
|
SpinnerColumn(),
|
|
1527
1539
|
TextColumn("[progress.description]{task.description}"),
|
|
1528
1540
|
transient=True,
|
|
1541
|
+
console=err_console
|
|
1529
1542
|
)
|
|
1530
1543
|
progress.start()
|
|
1531
1544
|
progress.add_task(
|
|
@@ -1740,6 +1753,7 @@ class ByoSnap:
|
|
|
1740
1753
|
SpinnerColumn(),
|
|
1741
1754
|
TextColumn("[progress.description]{task.description}"),
|
|
1742
1755
|
transient=True,
|
|
1756
|
+
console=err_console
|
|
1743
1757
|
)
|
|
1744
1758
|
progress.start()
|
|
1745
1759
|
progress.add_task(
|
|
@@ -17,6 +17,7 @@ from rich.progress import Progress, SpinnerColumn, TextColumn
|
|
|
17
17
|
from snapctl.config.constants import SERVER_CALL_TIMEOUT, SNAPCTL_INPUT_ERROR, \
|
|
18
18
|
SNAPCTL_BYOWS_GENERIC_ERROR, SNAPCTL_DEPENDENCY_MISSING, \
|
|
19
19
|
SNAPCTL_BYOWS_ATTACH_ERROR, SNAPCTL_BYOWS_DETACH_ERROR, SNAPCTL_BYOWS_RESET_ERROR
|
|
20
|
+
from snapctl.utils.console import err_console
|
|
20
21
|
from snapctl.utils.helper import snapctl_error, snapctl_success, get_dot_snapser_dir
|
|
21
22
|
from snapctl.utils.echo import info, warning
|
|
22
23
|
|
|
@@ -363,6 +364,7 @@ class Byows:
|
|
|
363
364
|
SpinnerColumn(),
|
|
364
365
|
TextColumn("[progress.description]{task.description}"),
|
|
365
366
|
transient=True,
|
|
367
|
+
console=err_console
|
|
366
368
|
)
|
|
367
369
|
progress.start()
|
|
368
370
|
progress.add_task(
|
|
@@ -448,6 +450,7 @@ class Byows:
|
|
|
448
450
|
SpinnerColumn(),
|
|
449
451
|
TextColumn("[progress.description]{task.description}"),
|
|
450
452
|
transient=True,
|
|
453
|
+
console=err_console
|
|
451
454
|
)
|
|
452
455
|
progress.start()
|
|
453
456
|
progress.add_task(
|
|
@@ -487,6 +490,7 @@ class Byows:
|
|
|
487
490
|
SpinnerColumn(),
|
|
488
491
|
TextColumn("[progress.description]{task.description}"),
|
|
489
492
|
transient=True,
|
|
493
|
+
console=err_console
|
|
490
494
|
)
|
|
491
495
|
progress.start()
|
|
492
496
|
progress.add_task(
|
|
@@ -9,6 +9,7 @@ from snapctl.config.constants import SERVER_CALL_TIMEOUT, SNAPCTL_INPUT_ERROR, \
|
|
|
9
9
|
SNAPCTL_GAME_CREATE_ERROR, SNAPCTL_GAME_ENUMERATE_ERROR, \
|
|
10
10
|
HTTP_ERROR_DUPLICATE_GAME_NAME, SNAPCTL_GAME_CREATE_DUPLICATE_NAME_ERROR, \
|
|
11
11
|
HTTP_ERROR_GAME_LIMIT_REACHED, SNAPCTL_GAME_CREATE_LIMIT_ERROR
|
|
12
|
+
from snapctl.utils.console import err_console
|
|
12
13
|
from snapctl.utils.helper import snapctl_error, snapctl_success
|
|
13
14
|
|
|
14
15
|
|
|
@@ -58,6 +59,7 @@ class Game:
|
|
|
58
59
|
SpinnerColumn(),
|
|
59
60
|
TextColumn("[progress.description]{task.description}"),
|
|
60
61
|
transient=True,
|
|
62
|
+
console=err_console
|
|
61
63
|
)
|
|
62
64
|
progress.start()
|
|
63
65
|
progress.add_task(
|
|
@@ -107,6 +109,7 @@ class Game:
|
|
|
107
109
|
SpinnerColumn(),
|
|
108
110
|
TextColumn("[progress.description]{task.description}"),
|
|
109
111
|
transient=True,
|
|
112
|
+
console=err_console
|
|
110
113
|
)
|
|
111
114
|
progress.start()
|
|
112
115
|
progress.add_task(
|
|
@@ -10,6 +10,7 @@ from rich.progress import Progress, SpinnerColumn, TextColumn
|
|
|
10
10
|
from snapctl.config.constants import SNAPCTL_INPUT_ERROR, \
|
|
11
11
|
SNAPCTL_GENERATE_GENERIC_ERROR, \
|
|
12
12
|
SNAPCTL_GENERATE_CREDENTIALS_ERROR
|
|
13
|
+
from snapctl.utils.console import err_console
|
|
13
14
|
from snapctl.utils.helper import get_composite_token, snapctl_error, snapctl_success
|
|
14
15
|
|
|
15
16
|
|
|
@@ -93,6 +94,7 @@ class Generate:
|
|
|
93
94
|
SpinnerColumn(),
|
|
94
95
|
TextColumn("[progress.description]{task.description}"),
|
|
95
96
|
transient=True,
|
|
97
|
+
console=err_console
|
|
96
98
|
)
|
|
97
99
|
progress.start()
|
|
98
100
|
progress.add_task(
|
|
@@ -25,6 +25,7 @@ from snapctl.config.constants import SERVER_CALL_TIMEOUT, SNAPCTL_INPUT_ERROR, \
|
|
|
25
25
|
SNAPCTL_SNAPEND_CREATE_ERROR, HTTP_CONFLICT
|
|
26
26
|
from snapctl.config.hashes import PROTOS_TYPES, CLIENT_SDK_TYPES, SERVER_SDK_TYPES, \
|
|
27
27
|
SNAPEND_MANIFEST_TYPES, SDK_TYPES, SDK_ACCESS_AUTH_TYPE_LOOKUP
|
|
28
|
+
from snapctl.utils.console import err_console
|
|
28
29
|
from snapctl.utils.echo import error, success, info
|
|
29
30
|
from snapctl.utils.helper import snapctl_error, snapctl_success
|
|
30
31
|
from snapctl.utils.exceptions import SnapendDownloadException
|
|
@@ -634,6 +635,7 @@ class Snapend:
|
|
|
634
635
|
SpinnerColumn(),
|
|
635
636
|
TextColumn("[progress.description]{task.description}"),
|
|
636
637
|
transient=True,
|
|
638
|
+
console=err_console
|
|
637
639
|
)
|
|
638
640
|
progress.start()
|
|
639
641
|
progress.add_task(
|
|
@@ -667,6 +669,7 @@ class Snapend:
|
|
|
667
669
|
SpinnerColumn(),
|
|
668
670
|
TextColumn("[progress.description]{task.description}"),
|
|
669
671
|
transient=True,
|
|
672
|
+
console=err_console
|
|
670
673
|
)
|
|
671
674
|
progress.start()
|
|
672
675
|
progress.add_task(
|
|
@@ -753,6 +756,7 @@ class Snapend:
|
|
|
753
756
|
SpinnerColumn(),
|
|
754
757
|
TextColumn("[progress.description]{task.description}"),
|
|
755
758
|
transient=True,
|
|
759
|
+
console=err_console
|
|
756
760
|
)
|
|
757
761
|
progress.start()
|
|
758
762
|
progress.add_task(
|
|
@@ -831,6 +835,7 @@ class Snapend:
|
|
|
831
835
|
SpinnerColumn(),
|
|
832
836
|
TextColumn("[progress.description]{task.description}"),
|
|
833
837
|
transient=True,
|
|
838
|
+
console=err_console
|
|
834
839
|
)
|
|
835
840
|
progress.start()
|
|
836
841
|
progress.add_task(
|
|
@@ -939,6 +944,7 @@ class Snapend:
|
|
|
939
944
|
SpinnerColumn(),
|
|
940
945
|
TextColumn("[progress.description]{task.description}"),
|
|
941
946
|
transient=True,
|
|
947
|
+
console=err_console
|
|
942
948
|
)
|
|
943
949
|
progress.start()
|
|
944
950
|
progress.add_task(
|
|
@@ -1018,6 +1024,7 @@ class Snapend:
|
|
|
1018
1024
|
SpinnerColumn(),
|
|
1019
1025
|
TextColumn("[progress.description]{task.description}"),
|
|
1020
1026
|
transient=True,
|
|
1027
|
+
console=err_console
|
|
1021
1028
|
)
|
|
1022
1029
|
progress.start()
|
|
1023
1030
|
progress.add_task(
|
|
@@ -1054,6 +1061,7 @@ class Snapend:
|
|
|
1054
1061
|
SpinnerColumn(),
|
|
1055
1062
|
TextColumn("[progress.description]{task.description}"),
|
|
1056
1063
|
transient=True,
|
|
1064
|
+
console=err_console
|
|
1057
1065
|
)
|
|
1058
1066
|
progress.start()
|
|
1059
1067
|
progress.add_task(
|
|
@@ -1123,6 +1131,7 @@ class Snapend:
|
|
|
1123
1131
|
SpinnerColumn(),
|
|
1124
1132
|
TextColumn("[progress.description]{task.description}"),
|
|
1125
1133
|
transient=True,
|
|
1134
|
+
console=err_console
|
|
1126
1135
|
)
|
|
1127
1136
|
progress.start()
|
|
1128
1137
|
progress.add_task(
|
|
@@ -1163,6 +1172,7 @@ class Snapend:
|
|
|
1163
1172
|
SpinnerColumn(),
|
|
1164
1173
|
TextColumn("[progress.description]{task.description}"),
|
|
1165
1174
|
transient=True,
|
|
1175
|
+
console=err_console
|
|
1166
1176
|
)
|
|
1167
1177
|
progress.start()
|
|
1168
1178
|
progress.add_task(
|
|
@@ -10,6 +10,7 @@ from snapctl.config.constants import SNAPCTL_SNAPEND_MANIFEST_UPGRADE_ERROR, SNA
|
|
|
10
10
|
SNAPCTL_SNAPEND_MANIFEST_CREATE_ERROR, SNAPCTL_SNAPEND_MANIFEST_UPDATE_ERROR, \
|
|
11
11
|
SNAPCTL_INTERNAL_SERVER_ERROR, SNAPCTL_SNAPEND_MANIFEST_SYNC_ERROR
|
|
12
12
|
from snapctl.commands.snaps import Snaps
|
|
13
|
+
from snapctl.utils.console import err_console
|
|
13
14
|
from snapctl.utils.helper import snapctl_error, snapctl_success, check_duplicates_in_list
|
|
14
15
|
from snapctl.utils.echo import info, warning, success
|
|
15
16
|
|
|
@@ -474,6 +475,7 @@ class SnapendManifest:
|
|
|
474
475
|
SpinnerColumn(),
|
|
475
476
|
TextColumn("[progress.description]{task.description}"),
|
|
476
477
|
transient=True,
|
|
478
|
+
console=err_console
|
|
477
479
|
)
|
|
478
480
|
progress.start()
|
|
479
481
|
progress.add_task(
|
|
@@ -565,6 +567,7 @@ class SnapendManifest:
|
|
|
565
567
|
SpinnerColumn(),
|
|
566
568
|
TextColumn("[progress.description]{task.description}"),
|
|
567
569
|
transient=True,
|
|
570
|
+
console=err_console
|
|
568
571
|
)
|
|
569
572
|
progress.start()
|
|
570
573
|
progress.add_task(
|
|
@@ -611,6 +614,8 @@ class SnapendManifest:
|
|
|
611
614
|
)
|
|
612
615
|
final_snaps.sort(key=lambda x: x["id"])
|
|
613
616
|
self.manifest['service_definitions'] = final_snaps
|
|
617
|
+
if 'feature_definitions' not in self.manifest:
|
|
618
|
+
self.manifest['feature_definitions'] = []
|
|
614
619
|
|
|
615
620
|
final_features = []
|
|
616
621
|
if self.features and self.features != '':
|
|
@@ -677,6 +682,7 @@ class SnapendManifest:
|
|
|
677
682
|
SpinnerColumn(),
|
|
678
683
|
TextColumn("[progress.description]{task.description}"),
|
|
679
684
|
transient=True,
|
|
685
|
+
console=err_console
|
|
680
686
|
)
|
|
681
687
|
progress.start()
|
|
682
688
|
progress.add_task(
|
|
@@ -760,6 +766,7 @@ class SnapendManifest:
|
|
|
760
766
|
SpinnerColumn(),
|
|
761
767
|
TextColumn("[progress.description]{task.description}"),
|
|
762
768
|
transient=True,
|
|
769
|
+
console=err_console
|
|
763
770
|
)
|
|
764
771
|
progress.start()
|
|
765
772
|
progress.add_task(
|
|
@@ -825,7 +832,8 @@ class SnapendManifest:
|
|
|
825
832
|
f'Snaps "{",".join(final_removed_snap_ids)}" were removed. ')
|
|
826
833
|
current_snaps.sort(key=lambda x: x["id"])
|
|
827
834
|
self.manifest['service_definitions'] = current_snaps
|
|
828
|
-
|
|
835
|
+
if 'feature_definitions' not in self.manifest:
|
|
836
|
+
self.manifest['feature_definitions'] = []
|
|
829
837
|
current_features = self.manifest['feature_definitions']
|
|
830
838
|
final_added_features = []
|
|
831
839
|
final_removed_features = []
|
|
@@ -8,6 +8,7 @@ from requests.exceptions import RequestException
|
|
|
8
8
|
from rich.progress import Progress, SpinnerColumn, TextColumn
|
|
9
9
|
from snapctl.config.constants import SERVER_CALL_TIMEOUT, SNAPCTL_INPUT_ERROR, \
|
|
10
10
|
SNAPCTL_SNAPS_ENUMERATE_ERROR, SNAPCTL_INTERNAL_SERVER_ERROR
|
|
11
|
+
from snapctl.utils.console import err_console
|
|
11
12
|
from snapctl.utils.helper import snapctl_error, snapctl_success
|
|
12
13
|
from snapctl.utils.echo import info
|
|
13
14
|
|
|
@@ -64,7 +65,7 @@ class Snaps:
|
|
|
64
65
|
timeout=SERVER_CALL_TIMEOUT
|
|
65
66
|
)
|
|
66
67
|
response_json = res.json()
|
|
67
|
-
except
|
|
68
|
+
except:
|
|
68
69
|
pass
|
|
69
70
|
return response_json
|
|
70
71
|
|
|
@@ -76,6 +77,7 @@ class Snaps:
|
|
|
76
77
|
SpinnerColumn(),
|
|
77
78
|
TextColumn("[progress.description]{task.description}"),
|
|
78
79
|
transient=True,
|
|
80
|
+
console=err_console
|
|
79
81
|
)
|
|
80
82
|
progress.start()
|
|
81
83
|
progress.add_task(
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
"""
|
|
4
4
|
import configparser
|
|
5
5
|
import os
|
|
6
|
+
from typing import Union
|
|
6
7
|
from sys import platform
|
|
7
|
-
from typing import Union, Optional, List
|
|
8
8
|
import typer
|
|
9
9
|
import pyfiglet
|
|
10
10
|
|
|
@@ -26,10 +26,12 @@ from snapctl.config.constants import COMPANY_NAME, API_KEY, URL_KEY, CONFIG_FILE
|
|
|
26
26
|
from snapctl.config.endpoints import END_POINTS, GATEWAY_END_POINTS
|
|
27
27
|
from snapctl.config.hashes import PROTOS_TYPES, SERVICE_IDS, \
|
|
28
28
|
SNAPEND_MANIFEST_TYPES, SDK_TYPES
|
|
29
|
+
from snapctl.utils.console import err_console
|
|
29
30
|
from snapctl.utils.echo import error, success, info, warning
|
|
30
31
|
from snapctl.utils.helper import validate_api_key
|
|
31
32
|
from snapctl.utils.telemetry import telemetry
|
|
32
33
|
|
|
34
|
+
|
|
33
35
|
######### HELPER METHODS #########
|
|
34
36
|
|
|
35
37
|
|
|
@@ -152,8 +154,7 @@ def validate_command_context(
|
|
|
152
154
|
Validator to confirm if the context has been set properly
|
|
153
155
|
"""
|
|
154
156
|
if ctx.obj['api_key'] is None or ctx.obj['base_url'] == '':
|
|
155
|
-
error("Snapctl Configuration Incorrect. Unable to extract API Key"
|
|
156
|
-
SNAPCTL_CONFIGURATION_INCORRECT)
|
|
157
|
+
error("Snapctl Configuration Incorrect. Unable to extract API Key")
|
|
157
158
|
raise typer.Exit(code=SNAPCTL_CONFIGURATION_INCORRECT)
|
|
158
159
|
|
|
159
160
|
######### Globals #########
|
|
@@ -168,13 +169,13 @@ def draw_ascii_text():
|
|
|
168
169
|
SNAPEND_ENDPOINT=https://gateway-accel.snapser.com
|
|
169
170
|
"""
|
|
170
171
|
ascii_text = pyfiglet.figlet_format(COMPANY_NAME)
|
|
171
|
-
|
|
172
|
+
err_console.print(ascii_text)
|
|
172
173
|
parts = [f"{COMPANY_NAME} CLI"]
|
|
173
174
|
url_key_obj = extract_config(COMPANY_NAME_KEY, None)
|
|
174
175
|
if url_key_obj["value"]:
|
|
175
176
|
parts.append(f"for {url_key_obj['value']}")
|
|
176
177
|
parts.append(f"v{VERSION}")
|
|
177
|
-
|
|
178
|
+
err_console.print(" — ".join(parts))
|
|
178
179
|
|
|
179
180
|
|
|
180
181
|
app = typer.Typer(
|
|
@@ -2,11 +2,8 @@
|
|
|
2
2
|
This module contains functions to print messages to the console.
|
|
3
3
|
"""
|
|
4
4
|
import json
|
|
5
|
-
import typer
|
|
6
|
-
from rich import print
|
|
7
5
|
from rich.markup import escape
|
|
8
|
-
from snapctl.
|
|
9
|
-
from snapctl.types.definitions import ErrorResponse
|
|
6
|
+
from snapctl.utils.console import err_console
|
|
10
7
|
# Run `python -m rich.emoji` to get a list of all emojis that are supported
|
|
11
8
|
|
|
12
9
|
|
|
@@ -16,16 +13,12 @@ def _stringify_message(msg: object) -> str:
|
|
|
16
13
|
return str(msg)
|
|
17
14
|
|
|
18
15
|
|
|
19
|
-
def error(msg: object
|
|
16
|
+
def error(msg: object) -> None:
|
|
20
17
|
"""
|
|
21
18
|
Prints an error message to the console.
|
|
22
19
|
"""
|
|
23
20
|
msg = _stringify_message(msg)
|
|
24
|
-
|
|
25
|
-
error=True, code=code, msg=msg, data=data if data else ''
|
|
26
|
-
)
|
|
27
|
-
print(f"[bold red]Error[/bold red] {escape(msg)}")
|
|
28
|
-
typer.echo(json.dumps(error_response.to_dict()), err=True)
|
|
21
|
+
err_console.print(f"[bold red]Error[/bold red] {escape(msg)}")
|
|
29
22
|
|
|
30
23
|
|
|
31
24
|
def warning(msg: object) -> None:
|
|
@@ -33,7 +26,7 @@ def warning(msg: object) -> None:
|
|
|
33
26
|
Prints a warning message to the console.
|
|
34
27
|
"""
|
|
35
28
|
msg = _stringify_message(msg)
|
|
36
|
-
print(f"[bold yellow]Warning[/bold yellow] {escape(msg)}")
|
|
29
|
+
err_console.print(f"[bold yellow]Warning[/bold yellow] {escape(msg)}")
|
|
37
30
|
|
|
38
31
|
|
|
39
32
|
def info(msg: object) -> None:
|
|
@@ -41,7 +34,7 @@ def info(msg: object) -> None:
|
|
|
41
34
|
Prints an info message to the console.
|
|
42
35
|
"""
|
|
43
36
|
msg = _stringify_message(msg)
|
|
44
|
-
print(f"[bold blue]Info[/bold blue] {escape(msg)}")
|
|
37
|
+
err_console.print(f"[bold blue]Info[/bold blue] {escape(msg)}")
|
|
45
38
|
|
|
46
39
|
|
|
47
40
|
def success(msg: object) -> None:
|
|
@@ -49,4 +42,4 @@ def success(msg: object) -> None:
|
|
|
49
42
|
Prints a success message to the console.
|
|
50
43
|
"""
|
|
51
44
|
msg = _stringify_message(msg)
|
|
52
|
-
print(f"[bold green]Success[/bold green] {escape(msg)}")
|
|
45
|
+
err_console.print(f"[bold green]Success[/bold green] {escape(msg)}")
|
|
@@ -17,6 +17,7 @@ from snapctl.config.constants import HTTP_NOT_FOUND, HTTP_FORBIDDEN, HTTP_UNAUTH
|
|
|
17
17
|
from snapctl.config.hashes import ARCHITECTURE_MAPPING
|
|
18
18
|
from snapctl.utils.echo import error, success
|
|
19
19
|
from snapctl.config.app import APP_CONFIG
|
|
20
|
+
from snapctl.types.definitions import ErrorResponse
|
|
20
21
|
|
|
21
22
|
|
|
22
23
|
def validate_api_key(base_url: str, api_key: Union[str, None]) -> bool:
|
|
@@ -33,18 +34,18 @@ def validate_api_key(base_url: str, api_key: Union[str, None]) -> bool:
|
|
|
33
34
|
success('API Key validated')
|
|
34
35
|
return True
|
|
35
36
|
if res.status_code == HTTP_UNAUTHORIZED:
|
|
36
|
-
|
|
37
|
+
snapctl_error(
|
|
37
38
|
'API Key verification failed. Your API Key is either invalid or may have expired. ',
|
|
38
39
|
SNAPCTL_CONFIGURATION_ERROR
|
|
39
40
|
)
|
|
40
41
|
elif res.status_code == HTTP_FORBIDDEN:
|
|
41
|
-
|
|
42
|
+
snapctl_error(
|
|
42
43
|
'Permission denied. Your role has been revoked. Please contact your administrator.',
|
|
43
44
|
SNAPCTL_CONFIGURATION_ERROR
|
|
44
45
|
)
|
|
45
46
|
else:
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
snapctl_error('Failed to validate API Key. Error:',
|
|
48
|
+
SNAPCTL_CONFIGURATION_ERROR)
|
|
48
49
|
except RequestException as e:
|
|
49
50
|
error(f"Exception: Unable to update your snapend {e}")
|
|
50
51
|
raise typer.Exit(code=SNAPCTL_CONFIGURATION_ERROR)
|
|
@@ -142,18 +143,30 @@ def snapctl_success(message: str, progress: Union[Progress, None] = None, no_exi
|
|
|
142
143
|
"""
|
|
143
144
|
if progress:
|
|
144
145
|
progress.stop()
|
|
145
|
-
|
|
146
|
+
# Check if this is the last message in the flow and write to stdout accordingly
|
|
146
147
|
if not no_exit:
|
|
148
|
+
if isinstance(message, (dict, list)):
|
|
149
|
+
typer.echo(json.dumps(message))
|
|
150
|
+
else:
|
|
151
|
+
typer.echo(message)
|
|
147
152
|
raise typer.Exit(code=SNAPCTL_SUCCESS)
|
|
153
|
+
# This means there are more messages to come, so we write to stderr to avoid mixing with
|
|
154
|
+
# the final output
|
|
155
|
+
success(message)
|
|
148
156
|
|
|
149
157
|
|
|
150
|
-
def snapctl_error(message: str, code: int, progress: Union[Progress, None] = None
|
|
158
|
+
def snapctl_error(message: str, code: int, progress: Union[Progress, None] = None,
|
|
159
|
+
data: object = None):
|
|
151
160
|
"""
|
|
152
161
|
This function exits the snapctl
|
|
153
162
|
"""
|
|
154
163
|
if progress:
|
|
155
164
|
progress.stop()
|
|
156
|
-
|
|
165
|
+
error_response = ErrorResponse(
|
|
166
|
+
error=True, code=code, msg=message, data=data if data else ''
|
|
167
|
+
)
|
|
168
|
+
error(message)
|
|
169
|
+
typer.echo(json.dumps(error_response.to_dict()), err=True)
|
|
157
170
|
raise typer.Exit(code=code)
|
|
158
171
|
|
|
159
172
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|