primitive 0.1.9__py3-none-any.whl → 0.1.11__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.
primitive/__about__.py CHANGED
@@ -1,4 +1,4 @@
1
1
  # SPDX-FileCopyrightText: 2024-present Dylan Stein <dylan@steins.studio>
2
2
  #
3
3
  # SPDX-License-Identifier: MIT
4
- __version__ = "0.1.9"
4
+ __version__ = "0.1.11"
@@ -14,7 +14,11 @@ class Agent(BaseAction):
14
14
  logger.info(f" [*] Version: {__version__}")
15
15
 
16
16
  # self.primitive.hardware.update_hardware_system_info()
17
- self.primitive.hardware.check_in_http(is_available=True, is_online=True)
17
+ try:
18
+ self.primitive.hardware.check_in_http(is_available=True, is_online=True)
19
+ except Exception as ex:
20
+ logger.error(f"Error checking in hardware: {ex}")
21
+ sys.exit(1)
18
22
 
19
23
  try:
20
24
  while True:
@@ -171,12 +171,6 @@ class Hardware(BaseAction):
171
171
 
172
172
  gpu_config.append(gpu_info)
173
173
 
174
- # Raise an error if there is no valid gpu config
175
- if not gpu_config:
176
- message = "No valid gpu configuration"
177
- logger.error(message)
178
- raise NotImplementedError(message)
179
-
180
174
  return gpu_config
181
175
 
182
176
  def _get_windows_computer_service_product_values(self) -> Dict[str, str]:
@@ -417,29 +411,43 @@ class Hardware(BaseAction):
417
411
  input = new_state
418
412
  variables = {"input": input}
419
413
  try:
420
- result = self.primitive.session.execute(mutation, variable_values=variables)
421
- previous_state = self.previous_state
422
- self.previous_state = new_state.copy()
423
-
424
- message = " [*] Checked in successfully: "
425
- for key, value in new_state.items():
426
- if value != previous_state.get(key, None):
427
- if value is True:
428
- message = (
429
- message
430
- + click.style(f"{key}: ")
431
- + click.style("💤")
432
- + click.style(" ==> ✅ ", fg="green")
433
- )
414
+ result = self.primitive.session.execute(
415
+ mutation, variable_values=variables, get_execution_result=True
416
+ )
417
+ checkin_success = result.data.get("checkIn").get("lastCheckIn")
418
+ if messages := result.data.get("checkIn").get("messages"):
419
+ for message in messages:
420
+ logger.enable("primitive")
421
+ if message.get("kind") == "ERROR":
422
+ logger.error(message.get("message"))
434
423
  else:
435
- message = (
436
- message
437
- + click.style(f"{key}: ")
438
- + click.style("✅")
439
- + click.style(" ==> 💤 ", fg="yellow")
440
- )
441
- logger.info(message)
442
-
424
+ logger.debug(message.get("message"))
425
+
426
+ if checkin_success:
427
+ previous_state = self.previous_state
428
+ self.previous_state = new_state.copy()
429
+
430
+ message = " [*] Checked in successfully: "
431
+ for key, value in new_state.items():
432
+ if value != previous_state.get(key, None):
433
+ if value is True:
434
+ message = (
435
+ message
436
+ + click.style(f"{key}: ")
437
+ + click.style("💤")
438
+ + click.style(" ==> ✅ ", fg="green")
439
+ )
440
+ else:
441
+ message = (
442
+ message
443
+ + click.style(f"{key}: ")
444
+ + click.style("✅")
445
+ + click.style(" ==> 💤 ", fg="yellow")
446
+ )
447
+ logger.info(message)
448
+ else:
449
+ message = "Failed to check in!"
450
+ raise Exception(message)
443
451
  return result
444
452
  except client_exceptions.ClientConnectorError as exception:
445
453
  message = " [*] Failed to check in! "
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: primitive
3
- Version: 0.1.9
3
+ Version: 0.1.11
4
4
  Project-URL: Documentation, https://github.com//primitivecorp/primitive-cli#readme
5
5
  Project-URL: Issues, https://github.com//primitivecorp/primitive-cli/issues
6
6
  Project-URL: Source, https://github.com//primitivecorp/primitive-cli
@@ -1,8 +1,8 @@
1
- primitive/__about__.py,sha256=ZISDHEwYuDZ5fKFtcsW-ewhfzmkOO8yp5qFnYsNgT08,128
1
+ primitive/__about__.py,sha256=cEU7i5k8S0WhpV8qykCw-GDDdmS5X4Rl6vZ5cCkC7EE,129
2
2
  primitive/__init__.py,sha256=bwKdgggKNVssJFVPfKSxqFMz4IxSr54WWbmiZqTMPNI,106
3
3
  primitive/cli.py,sha256=LXSpPtqQLxkOXsnsbs4UN3n7G_pHCz8AkBFCrk7Is4g,1796
4
4
  primitive/client.py,sha256=3RMRNY4ZiGT2OKnZtquWyrXjRSgDe5HlZvtFNKZErLQ,2083
5
- primitive/agent/actions.py,sha256=9y8_zKg9fUV4VT_rx9geSo7sS0oBR5jWWMdXMJwMmFk,2758
5
+ primitive/agent/actions.py,sha256=f6bv2va1YrDfrzOVK2kTnelRQ2oEvmrLAmsPrxMCh7E,2893
6
6
  primitive/agent/commands.py,sha256=-dVDilELfkGfbZB7qfEPs77Dm1oT62qJj4tsIk4KoxI,254
7
7
  primitive/auth/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
8
  primitive/auth/actions.py,sha256=N2bGcwXNsB89pzs66gF9A5_WzUScY5fhfOyWixqo2y8,1054
@@ -11,7 +11,7 @@ primitive/files/actions.py,sha256=f4JN3QFB2WXw-0JpnE-4-movnqtvXIpCrGd_9pdkeW4,26
11
11
  primitive/files/commands.py,sha256=DDizo3xJnU3KLUBTMeeM72viVpnJinLwxs84tmqKhqo,810
12
12
  primitive/graphql/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
13
  primitive/graphql/sdk.py,sha256=BhCGmDtc4sNnH8CxbQSJyFwOZ-ZSqMtjsxMB3JRBhPw,1456
14
- primitive/hardware/actions.py,sha256=UL2Wyh_XFXKVNEvlVCe1ltCZHpNaRSXPNwSR8hGJyR0,18343
14
+ primitive/hardware/actions.py,sha256=Ea3_2E3F_3WapV60g_mOIcpXhadoknwihR7slXyUWtk,18840
15
15
  primitive/hardware/commands.py,sha256=QE7LLeFdfOqlvz3JwdwJJRZAY3fHI1zB9kYmmDajpq0,1477
16
16
  primitive/lint/actions.py,sha256=FVigksFrADPDD3zHS0g0riyVrge7eEtwWk5PG2aZv9A,2352
17
17
  primitive/lint/commands.py,sha256=3CZvkOEMpJspJWmaQzA5bpPKx0_VCijQIXA9l-eTnZE,487
@@ -27,8 +27,8 @@ primitive/utils/memory_size.py,sha256=4xfha21kW82nFvOTtDFx9Jk2ZQoEhkfXii-PGNTpIU
27
27
  primitive/utils/printer.py,sha256=f1XUpqi5dkTL3GWvYRUGlSwtj2IxU1q745T4Fxo7Tn4,370
28
28
  primitive/utils/shell.py,sha256=-7UjQaBqSGHzEEyX8pNjeYFFP0P3lVnDV0OkgPz1qHU,1050
29
29
  primitive/utils/verible.py,sha256=QYczN1IvxODfj4jeq0nqjFuF0Oi0Zdx-Q32ySOJgcw8,2205
30
- primitive-0.1.9.dist-info/METADATA,sha256=MZhFwacKp68g2ffhknZfVy84VRSTgCsJu7zMttrE1V8,1817
31
- primitive-0.1.9.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
32
- primitive-0.1.9.dist-info/entry_points.txt,sha256=p1K8DMCWka5FqLlqP1sPek5Uovy9jq8u51gUsP-z334,48
33
- primitive-0.1.9.dist-info/licenses/LICENSE.txt,sha256=B8kmQMJ2sxYygjCLBk770uacaMci4mPSoJJ8WoDBY_c,1098
34
- primitive-0.1.9.dist-info/RECORD,,
30
+ primitive-0.1.11.dist-info/METADATA,sha256=-KZVIgcT4_othtd9SQqixiI7PhsJNcgUzeO7wQxRw7s,1818
31
+ primitive-0.1.11.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
32
+ primitive-0.1.11.dist-info/entry_points.txt,sha256=p1K8DMCWka5FqLlqP1sPek5Uovy9jq8u51gUsP-z334,48
33
+ primitive-0.1.11.dist-info/licenses/LICENSE.txt,sha256=B8kmQMJ2sxYygjCLBk770uacaMci4mPSoJJ8WoDBY_c,1098
34
+ primitive-0.1.11.dist-info/RECORD,,