snapctl 0.44.1__py3-none-any.whl → 0.46.1__py3-none-any.whl

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.

snapctl/commands/byogs.py CHANGED
@@ -37,30 +37,27 @@ class ByoGs:
37
37
  def __init__(
38
38
  self, *, subcommand: str, base_url: str, api_key: Union[str, None],
39
39
  tag: Union[str, None] = None, path: Union[str, None] = None,
40
- resources_path: Union[str, None] = None, dockerfile: Union[str, None] = None,
40
+ resources_path: Union[str, None] = None, docker_filename: Union[str, None] = None,
41
41
  skip_build: bool = False, snapend_id: Union[str, None] = None,
42
42
  fleet_names: Union[str, None] = None, blocking: bool = False
43
43
  ) -> None:
44
44
  self.subcommand: str = subcommand
45
45
  self.base_url: str = base_url
46
46
  self.api_key: Union[str, None] = api_key
47
- # self.sid: str = sid
48
- # if subcommand == 'publish':
49
- # self.sid = ByoGs.SID
50
-
51
- self.token: Union[str, None] = get_composite_token(
52
- base_url, api_key, 'byogs', {'service_id': ByoGs.SID}
53
- )
54
- self.token_parts: Union[List, None] = ByoGs._get_token_values(
55
- self.token) if self.token is not None else None
56
47
  self.tag: Union[str, None] = tag
57
48
  self.path: Union[str, None] = path
58
49
  self.resources_path: Union[str, None] = resources_path
59
- self.dockerfile: str = dockerfile
50
+ self.docker_filename: str = docker_filename
60
51
  self.skip_build: bool = skip_build
61
52
  self.snapend_id: Union[str, None] = snapend_id
62
53
  self.fleet_names: Union[str, None] = fleet_names
63
54
  self.blocking: bool = blocking
55
+ # Values below are derived values
56
+ self.token: Union[str, None] = get_composite_token(
57
+ base_url, api_key, 'byogs', {'service_id': ByoGs.SID}
58
+ )
59
+ self.token_parts: Union[List, None] = ByoGs._get_token_values(
60
+ self.token) if self.token is not None else None
64
61
  # Validate input
65
62
  self.validate_input()
66
63
 
@@ -131,7 +128,7 @@ class ByoGs:
131
128
  try:
132
129
  # Login to Snapser Registry
133
130
  if platform == 'win32':
134
- # Start: Hack for Windows
131
+ # Start: Hack for Windows
135
132
  data = {
136
133
  "auths": {
137
134
  "https://index.docker.io/v1/": {}
@@ -139,7 +136,8 @@ class ByoGs:
139
136
  }
140
137
 
141
138
  # Path to the Docker config file, adjust the path as necessary
142
- docker_config_path = os.path.expanduser('~\\.docker\\config.json')
139
+ docker_config_path = os.path.expanduser(
140
+ '~\\.docker\\config.json')
143
141
 
144
142
  # Ensure the directory exists
145
143
  os.makedirs(os.path.dirname(docker_config_path), exist_ok=True)
@@ -191,7 +189,7 @@ class ByoGs:
191
189
  base_path = self.resources_path
192
190
  else:
193
191
  base_path = self.path
194
- docker_file_path = os.path.join(base_path, self.dockerfile)
192
+ docker_file_path = os.path.join(base_path, self.docker_filename)
195
193
 
196
194
  # Warning check for architecture specific commands
197
195
  info(f'Building on system architecture {sys_platform.machine()}')
@@ -373,14 +371,15 @@ class ByoGs:
373
371
  code=SNAPCTL_INPUT_ERROR)
374
372
  # Check path
375
373
  if self.resources_path:
376
- docker_file_path = f"{self.resources_path}/{self.dockerfile}"
374
+ docker_file_path = f"{
375
+ self.resources_path}/{self.docker_filename}"
377
376
  else:
378
- docker_file_path = f"{self.path}/{self.dockerfile}"
377
+ docker_file_path = f"{self.path}/{self.docker_filename}"
379
378
 
380
379
  if not self.skip_build and not os.path.isfile(docker_file_path):
381
380
  snapctl_error(
382
381
  message="Unable to find " +
383
- f"{self.dockerfile} at path {docker_file_path}",
382
+ f"{self.docker_filename} at path {docker_file_path}",
384
383
  code=SNAPCTL_INPUT_ERROR)
385
384
  elif self.subcommand == 'sync':
386
385
  if not self.skip_build and not self.path:
@@ -389,14 +388,15 @@ class ByoGs:
389
388
  code=SNAPCTL_INPUT_ERROR)
390
389
  # Check path
391
390
  if self.resources_path:
392
- docker_file_path = f"{self.resources_path}/{self.dockerfile}"
391
+ docker_file_path = f"{
392
+ self.resources_path}/{self.docker_filename}"
393
393
  else:
394
- docker_file_path = f"{self.path}/{self.dockerfile}"
394
+ docker_file_path = f"{self.path}/{self.docker_filename}"
395
395
 
396
396
  if not self.skip_build and not os.path.isfile(docker_file_path):
397
397
  snapctl_error(
398
398
  message="Unable to find " +
399
- f"{self.dockerfile} at path {docker_file_path}",
399
+ f"{self.docker_filename} at path {docker_file_path}",
400
400
  code=SNAPCTL_INPUT_ERROR)
401
401
  if not self.snapend_id:
402
402
  snapctl_error(