Skip to content

Commit

Permalink
update old entries
Browse files Browse the repository at this point in the history
  • Loading branch information
maskarb committed May 8, 2024
1 parent f985fc7 commit fe61bc4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
10 changes: 7 additions & 3 deletions koku/masu/database/ocp_report_db_accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -904,13 +904,17 @@ def populate_node_table(self, cluster, nodes):
resource_id=node[1],
node_capacity_cpu_cores=node[2],
node_role=node[3],
arch=node[4],
architecture=node[4],
cluster=cluster,
)
# if the node entry already exists but does not have a role assigned, update the node role
elif not tmp_node.node_role:
if not tmp_node.node_role:
tmp_node.node_role = node[3]
tmp_node.save()
tmp_node.save(update_fields=["node_role"])
# if the node entry already exists but does not have an architecture, update the architecture
if not tmp_node.architecture:
tmp_node.architecture = node[4]
tmp_node.save(update_fields=["architecture"])

def populate_pvc_table(self, cluster, pvcs):
"""Get or create an entry in the OCP cluster table."""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@

class Migration(migrations.Migration):
dependencies = [
("reporting", "0318_ocpazurecomputesummaryp_subscription_name_and_more"),
("reporting", "0319_node_network_costs"),
]

operations = [
migrations.AddField(
model_name="ocpnode",
name="arch",
name="architecture",
field=models.TextField(null=True),
),
]
2 changes: 1 addition & 1 deletion koku/reporting/provider/ocp/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ class Meta:
node_capacity_cpu_cores = models.DecimalField(max_digits=18, decimal_places=2, null=True)
cluster = models.ForeignKey("OCPCluster", on_delete=models.CASCADE)
node_role = models.TextField(null=True)
arch = models.TextField(null=True)
architecture = models.TextField(null=True)


class OCPNetworkSummaryP(models.Model):
Expand Down

0 comments on commit fe61bc4

Please sign in to comment.