infrahub-server 1.4.1__py3-none-any.whl → 1.4.3__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.
infrahub/core/models.py CHANGED
@@ -73,6 +73,15 @@ class SchemaBranchHash(BaseModel):
73
73
  nodes: dict[str, str] = Field(default_factory=dict)
74
74
  generics: dict[str, str] = Field(default_factory=dict)
75
75
 
76
+ @property
77
+ def is_valid(self) -> bool:
78
+ """
79
+ TODO: This is a temporary solution to avoid comparing schema hashes if there are less than 2 nodes or generics.
80
+ """
81
+ if len(self.nodes) < 2 and len(self.generics) < 2:
82
+ return False
83
+ return True
84
+
76
85
  def compare(self, other: SchemaBranchHash) -> SchemaBranchDiff | None:
77
86
  if other.main == self.main:
78
87
  return None
@@ -615,7 +615,9 @@ class SchemaManager(NodeManager):
615
615
  return new_branch_schema
616
616
 
617
617
  current_schema = self.get_schema_branch(name=branch.name)
618
- schema_diff = current_schema.get_hash_full().compare(branch.active_schema_hash)
618
+ schema_diff = None
619
+ if branch.active_schema_hash.is_valid and current_schema.get_hash_full().is_valid:
620
+ schema_diff = current_schema.get_hash_full().compare(branch.active_schema_hash)
619
621
  branch_schema = await self.load_schema_from_db(
620
622
  db=db, branch=branch, schema=current_schema, schema_diff=schema_diff
621
623
  )
@@ -4,6 +4,7 @@ from typing import TYPE_CHECKING
4
4
 
5
5
  from infrahub import lock
6
6
  from infrahub.core import registry
7
+ from infrahub.core.constants import GLOBAL_BRANCH_NAME
7
8
  from infrahub.log import get_logger
8
9
  from infrahub.worker import WORKER_IDENTITY
9
10
 
@@ -81,16 +82,21 @@ async def refresh_branches(db: InfrahubDatabase) -> None:
81
82
  from infrahub.graphql.manager import GraphQLSchemaManager
82
83
 
83
84
  async with lock.registry.local_schema_lock():
84
- branches = await registry.branch_object.get_list(db=db)
85
- for new_branch in branches:
86
- if new_branch.name in registry.branch:
87
- await update_branch_registry(db=db, branch=new_branch)
85
+ active_branches = await registry.branch_object.get_list(db=db)
86
+ for active_branch in active_branches:
87
+ if active_branch.name == GLOBAL_BRANCH_NAME:
88
+ # Avoid processing updates for the global branch as it doesn't
89
+ # have an associated schema
90
+ continue
91
+
92
+ if active_branch.name in registry.branch:
93
+ await update_branch_registry(db=db, branch=active_branch)
88
94
  else:
89
- await create_branch_registry(db=db, branch=new_branch)
95
+ await create_branch_registry(db=db, branch=active_branch)
90
96
 
91
- purged_branches = await registry.purge_inactive_branches(db=db, active_branches=branches)
97
+ purged_branches = await registry.purge_inactive_branches(db=db, active_branches=active_branches)
92
98
  purged_branches.update(
93
- GraphQLSchemaManager.purge_inactive(active_branches=[branch.name for branch in branches])
99
+ GraphQLSchemaManager.purge_inactive(active_branches=[branch.name for branch in active_branches])
94
100
  )
95
101
  for branch_name in sorted(purged_branches):
96
102
  log.info(f"Removed branch {branch_name!r} from the registry", branch=branch_name, worker=WORKER_IDENTITY)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: infrahub-server
3
- Version: 1.4.1
3
+ Version: 1.4.3
4
4
  Summary: Infrahub is taking a new approach to Infrastructure Management by providing a new generation of datastore to organize and control all the data that defines how an infrastructure should run.
5
5
  License: Apache-2.0
6
6
  Author: OpsMill
@@ -97,7 +97,7 @@ If you just want to try Infrahub out, you can use our [Infrahub Sandbox](https:/
97
97
 
98
98
  **Service Catalog** - Infrahub acts as the underlying system to provide infrastructure-as-a-service, allowing you to manage your services and lifecycle them as the services evolve.
99
99
 
100
- **Infrastructure Automation** - Provide infrastructure and network automation workflows with Infrahub rendering configurations and artifacts via Jinja2 and python,then passing to deployment tools such as [Nornir](https://www.opsmill.com/simplifying-network-automation-workflows-with-infrahub-nornir-and-jinja2/), [Ansible](https://docs.infrahub.app/ansible/ansible/), Terraform, or vendor-specific tools.
100
+ **Infrastructure Automation** - Provide infrastructure and network automation workflows with Infrahub rendering configurations and artifacts via Jinja2 and python,then passing to deployment tools such as [Nornir](https://www.opsmill.com/simplifying-network-automation-workflows-with-infrahub-nornir-and-jinja2/), [Ansible](https://docs.infrahub.app/ansible), Terraform, or vendor-specific tools.
101
101
 
102
102
  **Inventory Management** - Infrahub serves as a centralized inventory system for your infrastructure, allowing you to manage your inventory and track changes to your infrastructure. It provides a WebUI and API for other teams to self-service the information needed to allow the organization to operate.
103
103
 
@@ -119,7 +119,7 @@ For longer term tests, you can deploy a local instance of Infrahub by referring
119
119
 
120
120
  If you'd like to learn more about Infrahub, please refer to the following resources:
121
121
 
122
- - [Infrahub Overview](https://docs.infrahub.app/overview/)
122
+ - [Infrahub Overview](https://docs.infrahub.app/getting-started/overview)
123
123
  - [Infrahub Documentation](https://docs.infrahub.app/)
124
124
  - [FAQ](https://docs.infrahub.app/faq/)
125
125
 
@@ -214,7 +214,7 @@ infrahub/core/migrations/schema/node_remove.py,sha256=NdPNZH9qXf6HbyTMSaQ3aU58XW
214
214
  infrahub/core/migrations/schema/placeholder_dummy.py,sha256=3T3dBwC_ZyehOJr2KRKFD6CXaq8QIjVk0N-nWAMvFYw,308
215
215
  infrahub/core/migrations/schema/tasks.py,sha256=2J8gHGSP-WhxSi4GYhOc9xAJOg_S1ONm3YE4_ukLKxw,4164
216
216
  infrahub/core/migrations/shared.py,sha256=G72VIHtH4DOM09UOXZE2zfILGDej7nPKdvdfrPRMp7M,7921
217
- infrahub/core/models.py,sha256=p2XwVzLiTNwz_4Bs4MTJD64wneR9bCUtfGs_ybBQn1c,26354
217
+ infrahub/core/models.py,sha256=xwEeXSTD4j13hbyZAjZAlrhXk1hHvWl9I7ve7uUbR7U,26649
218
218
  infrahub/core/node/__init__.py,sha256=6qtg-hzuH-hTxX4hJrhAB_lUmcIx404wyn35WhiMgZo,42435
219
219
  infrahub/core/node/base.py,sha256=BAowVRCK_WC50yXym1kCyUppJDJnrODGU5uoj1s0Yd4,2564
220
220
  infrahub/core/node/constraints/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -299,7 +299,7 @@ infrahub/core/schema/generated/genericnode_schema.py,sha256=FvfeYfld9YeKHOzyH6G3
299
299
  infrahub/core/schema/generated/node_schema.py,sha256=PMgbQX1PC5ixQsjOFw_bcEfa4txGNUI6BV6OkFDG3wQ,1631
300
300
  infrahub/core/schema/generated/relationship_schema.py,sha256=F198_LNmQRV0xSEBPRA3vBAioEItpYZVNApOmdb8_E4,5851
301
301
  infrahub/core/schema/generic_schema.py,sha256=KSd5fwMDR2hjrsb1vOaK83Lw5jJAob1FLoudgU5_E2Y,1594
302
- infrahub/core/schema/manager.py,sha256=RAMox35C36eTELkfukVnQ5L9ob-RIZyDcvrHeVye1Ic,33123
302
+ infrahub/core/schema/manager.py,sha256=ImD9jTctdkVc6UXyynP8PUZ2gE6wr87upTpelcLzBfI,33245
303
303
  infrahub/core/schema/node_schema.py,sha256=cWeQ2iu6Z9Ay6l2gYnPRnS0JAqYQccueYhpEcfep9Mo,6252
304
304
  infrahub/core/schema/profile_schema.py,sha256=sV4lp1UyBye12M7BJcA2obb4tx3M9J5P89SLqkmFxJY,1237
305
305
  infrahub/core/schema/relationship_schema.py,sha256=R-1iC1d70bBW0vWhgJhDB0_J3tRpOqcJmmLzh39NuYs,8501
@@ -662,7 +662,7 @@ infrahub/tasks/check.py,sha256=37n1U1Knb3AV6kz2sw_IabL9pnlqceLVICWf9GdSxZE,687
662
662
  infrahub/tasks/dummy.py,sha256=6SxlQqQXZqgTuwLaAsK-p1O1TYNKfdGmUYjNJFNHe9s,1209
663
663
  infrahub/tasks/keepalive.py,sha256=D6yh3Vmlr1WCEpZibk2YLc2n0dCcX6tM62HCSxyGEu8,783
664
664
  infrahub/tasks/recurring.py,sha256=RJO2zdzCU-38Kb81lmCUbFQOBhGui8qn2QizTV4vj9I,447
665
- infrahub/tasks/registry.py,sha256=QfpC3-HSZoytehkDY3Q9_MdvDN0J_xUAUi1fyAgCYyU,3656
665
+ infrahub/tasks/registry.py,sha256=zanLxRT_RFkYV2Y3OQedHu2-PTBwoExbAzgokT0TZjQ,3957
666
666
  infrahub/telemetry/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
667
667
  infrahub/telemetry/constants.py,sha256=_5mJAZaT_wTCaF7Yzsd---Zn1N6GZkoP_954GK8K4-c,184
668
668
  infrahub/telemetry/database.py,sha256=9UVPOxRionVF65jjo8slRIaNBOv-KMRzq7I-7fe3wZE,3111
@@ -826,8 +826,8 @@ infrahub_testcontainers/models.py,sha256=ASYyvl7d_WQz_i7y8-3iab9hwwmCl3OCJavqVbe
826
826
  infrahub_testcontainers/performance_test.py,sha256=hvwiy6tc_lWniYqGkqfOXVGAmA_IV15VOZqbiD9ezno,6149
827
827
  infrahub_testcontainers/plugin.py,sha256=I3RuZQ0dARyKHuqCf0y1Yj731P2Mwf3BJUehRJKeWrs,5645
828
828
  infrahub_testcontainers/prometheus.yml,sha256=610xQEyj3xuVJMzPkC4m1fRnCrjGpiRBrXA2ytCLa54,599
829
- infrahub_server-1.4.1.dist-info/LICENSE.txt,sha256=7GQO7kxVoQYnZtFrjZBKLRXbrGwwwimHPPOJtqXsozQ,11340
830
- infrahub_server-1.4.1.dist-info/METADATA,sha256=HyDVqhcrCXqCmaJn77mWKJ_40SZ0G_Hmpk5MMvxo08g,8271
831
- infrahub_server-1.4.1.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
832
- infrahub_server-1.4.1.dist-info/entry_points.txt,sha256=UXIeFWDsrV-4IllNvUEd6KieYGzQfn9paga2YyABOQI,393
833
- infrahub_server-1.4.1.dist-info/RECORD,,
829
+ infrahub_server-1.4.3.dist-info/LICENSE.txt,sha256=7GQO7kxVoQYnZtFrjZBKLRXbrGwwwimHPPOJtqXsozQ,11340
830
+ infrahub_server-1.4.3.dist-info/METADATA,sha256=3sPnrG5a6lzgW83Theqmb2Ztk6JpquCmwM-AOHOS_4E,8277
831
+ infrahub_server-1.4.3.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
832
+ infrahub_server-1.4.3.dist-info/entry_points.txt,sha256=UXIeFWDsrV-4IllNvUEd6KieYGzQfn9paga2YyABOQI,393
833
+ infrahub_server-1.4.3.dist-info/RECORD,,