primitive 0.1.10__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.10"
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:
@@ -411,29 +411,43 @@ class Hardware(BaseAction):
411
411
  input = new_state
412
412
  variables = {"input": input}
413
413
  try:
414
- result = self.primitive.session.execute(mutation, variable_values=variables)
415
- previous_state = self.previous_state
416
- self.previous_state = new_state.copy()
417
-
418
- message = " [*] Checked in successfully: "
419
- for key, value in new_state.items():
420
- if value != previous_state.get(key, None):
421
- if value is True:
422
- message = (
423
- message
424
- + click.style(f"{key}: ")
425
- + click.style("💤")
426
- + click.style(" ==> ✅ ", fg="green")
427
- )
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"))
428
423
  else:
429
- message = (
430
- message
431
- + click.style(f"{key}: ")
432
- + click.style("✅")
433
- + click.style(" ==> 💤 ", fg="yellow")
434
- )
435
- logger.info(message)
436
-
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)
437
451
  return result
438
452
  except client_exceptions.ClientConnectorError as exception:
439
453
  message = " [*] Failed to check in! "
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: primitive
3
- Version: 0.1.10
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=vkCI2gNB3TqHjGAyScIcoS3jD3nsqounK3F58yE9FHI,129
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=fwQmPFhL_h2CRXtGI6X-rgjjw9GEXp72wsuzzr3XKPY,18126
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.10.dist-info/METADATA,sha256=1VoQWwL-imz5ZtMnUAvisAhHiizcKclfhdhk4uk3SIs,1818
31
- primitive-0.1.10.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
32
- primitive-0.1.10.dist-info/entry_points.txt,sha256=p1K8DMCWka5FqLlqP1sPek5Uovy9jq8u51gUsP-z334,48
33
- primitive-0.1.10.dist-info/licenses/LICENSE.txt,sha256=B8kmQMJ2sxYygjCLBk770uacaMci4mPSoJJ8WoDBY_c,1098
34
- primitive-0.1.10.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,,