snapctl 0.43.2__tar.gz → 0.44.1__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.

Potentially problematic release.


This version of snapctl might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: snapctl
3
- Version: 0.43.2
3
+ Version: 0.44.1
4
4
  Summary: Snapser CLI Tool
5
5
  Author: Ajinkya Apte
6
6
  Author-email: aj@snapser.com
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "snapctl"
3
- version = "0.43.2"
3
+ version = "0.44.1"
4
4
  description = "Snapser CLI Tool"
5
5
  authors = ["Ajinkya Apte <aj@snapser.com>"]
6
6
  readme = "README.md"
@@ -4,6 +4,7 @@
4
4
  import base64
5
5
  from binascii import Error as BinasciiError
6
6
  import os
7
+ import json
7
8
  import subprocess
8
9
  import time
9
10
  import platform as sys_platform
@@ -130,6 +131,24 @@ class ByoGs:
130
131
  try:
131
132
  # Login to Snapser Registry
132
133
  if platform == 'win32':
134
+ # Start: Hack for Windows
135
+ data = {
136
+ "auths": {
137
+ "https://index.docker.io/v1/": {}
138
+ }
139
+ }
140
+
141
+ # Path to the Docker config file, adjust the path as necessary
142
+ docker_config_path = os.path.expanduser('~\\.docker\\config.json')
143
+
144
+ # Ensure the directory exists
145
+ os.makedirs(os.path.dirname(docker_config_path), exist_ok=True)
146
+
147
+ # Write the data to the file
148
+ with open(docker_config_path, 'w', encoding='utf-8') as file:
149
+ json.dump(data, file)
150
+ info("Updated the docker config for docker login")
151
+ # End: Hack for Windows
133
152
  response = subprocess.run([
134
153
  'docker', 'login', '--username', ecr_repo_username,
135
154
  '--password', ecr_repo_token, ecr_repo_url
@@ -261,6 +261,10 @@ class ByoSnap:
261
261
  if self.prefix.endswith('/'):
262
262
  snapctl_error("Prefix should not end with a forward slash (/)",
263
263
  SNAPCTL_INPUT_ERROR)
264
+ # check that prefix does not contain multiple slashes
265
+ if self.prefix.count('/') > 1:
266
+ snapctl_error("Prefix should not contain multiple path segments",
267
+ SNAPCTL_INPUT_ERROR)
264
268
  if not self.version:
265
269
  snapctl_error("Missing version", SNAPCTL_INPUT_ERROR)
266
270
  pattern = r'^v\d+\.\d+\.\d+$'
@@ -372,6 +376,25 @@ class ByoSnap:
372
376
  try:
373
377
  # Login to Snapser Registry
374
378
  if platform == 'win32':
379
+ # Start: Hack for Windows
380
+ data = {
381
+ "auths": {
382
+ "https://index.docker.io/v1/": {}
383
+ }
384
+ }
385
+
386
+ # Path to the Docker config file, adjust the path as necessary
387
+ docker_config_path = os.path.expanduser(
388
+ '~\\.docker\\config.json')
389
+
390
+ # Ensure the directory exists
391
+ os.makedirs(os.path.dirname(docker_config_path), exist_ok=True)
392
+
393
+ # Write the data to the file
394
+ with open(docker_config_path, 'w', encoding='utf-8') as file:
395
+ json.dump(data, file)
396
+ info("Updated the docker config for docker login")
397
+ # End: Hack for Windows
375
398
  response = subprocess.run([
376
399
  'docker', 'login', '--username', ecr_repo_username,
377
400
  '--password', ecr_repo_token, ecr_repo_url
@@ -640,6 +663,15 @@ class ByoSnap:
640
663
  if self.path is None and self.resources_path is None:
641
664
  snapctl_error(
642
665
  "Missing one of: path or resources-path parameter", SNAPCTL_INPUT_ERROR)
666
+ if not self.tag:
667
+ snapctl_error("Missing tag", SNAPCTL_INPUT_ERROR)
668
+ if len(self.tag.split()) > 1 or \
669
+ len(self.tag) > ByoSnap.TAG_CHARACTER_LIMIT:
670
+ snapctl_error(
671
+ "Tag should be a single word with maximum of " +
672
+ f"{ByoSnap.TAG_CHARACTER_LIMIT} characters",
673
+ SNAPCTL_INPUT_ERROR
674
+ )
643
675
  elif self.subcommand == 'publish-version':
644
676
  if self.token_parts is None:
645
677
  snapctl_error('Invalid token. Please reach out to your support team.',
@@ -2,7 +2,7 @@
2
2
  Constants used by snapctl
3
3
  """
4
4
  COMPANY_NAME = 'Snapser'
5
- VERSION = '0.43.2'
5
+ VERSION = '0.44.1'
6
6
  CONFIG_FILE_MAC = '~/.snapser/config'
7
7
  CONFIG_FILE_WIN = '%homepath%\\.snapser\\config'
8
8
 
@@ -192,7 +192,7 @@ BYOSNAP_TEMPLATE: Dict[str, Dict[str, object]] = {
192
192
  'description': "TODO: Add your BYOSnap description here",
193
193
  'platform': "TODO: Add your platform here. Options are 'linux/arm64' or 'linux/amd64'",
194
194
  'language': "TODO: Add your language here. Options are 'go', 'node', 'python', 'java', 'csharp', 'cpp', 'rust', 'ruby', 'php', 'perl', 'clojure', 'lua', 'ts', 'js', 'kotlin', 'c'",
195
- 'prefix': "TODO: Add your prefix here. Prefix should start with /. Eg: '/v1'",
195
+ 'prefix': "TODO: Add your prefix here. Prefix should start with / and only contain one path segment. Eg: '/v1'",
196
196
  'ingress': {
197
197
  'external_port': {
198
198
  'name': 'http',
@@ -361,7 +361,7 @@ def byosnap(
361
361
  # publish-image and publish-version
362
362
  tag: str = typer.Option(
363
363
  None, "--tag", help=(
364
- "(req: publish-image, publish-version) Tag for your snap"
364
+ "(req: publish-image, publish-version, upload-docs) Tag for your snap"
365
365
  )
366
366
  ),
367
367
  # overrides
File without changes
File without changes
File without changes
File without changes
File without changes