Skip to content

Commit

Permalink
Merge pull request #656 from WHOIGit/mario_dev_1.7.0
Browse files Browse the repository at this point in the history
deploy config default hotfix
  • Loading branch information
ethanandrews authored Nov 14, 2023
2 parents a34d0f1 + b6908ee commit fc103b5
Showing 1 changed file with 23 additions and 22 deletions.
45 changes: 23 additions & 22 deletions roundabout/builds/views_deployments.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,28 +461,29 @@ def form_valid(self, form):
self.request.user,
)
# generate inventory configevent with default values on deyployed to field
if not item.inventory_configevents.exists():
config_event, event_added = ConfigEvent.objects.get_or_create(
inventory=item,
config_type="conf",
configuration_date = action_date,
deployment = self.object
)
_create_action_history(config_event, Action.ADD, self.request.user, data={})
if item.assembly_part is not None:
if item.assembly_part.assemblypart_configdefaultevents.exists():
conf_def_event = item.assembly_part.assemblypart_configdefaultevents.first()
names = ConfigName.objects.filter(config_name_event = item.part.part_confignameevents.first(), config_type ='conf')
for name in names:
try:
default_value = ConfigDefault.objects.get(conf_def_event = conf_def_event, config_name = name).default_value
except ConfigDefault.DoesNotExist:
default_value = None
ConfigValue.objects.create(
config_event = config_event,
config_name = name,
config_value = default_value,
)
if action_type == Action.DEPLOYMENTTOFIELD:
if not item.inventory_configevents.exists():
config_event, event_added = ConfigEvent.objects.get_or_create(
inventory=item,
config_type="conf",
configuration_date = action_date,
deployment = self.object
)
_create_action_history(config_event, Action.ADD, self.request.user, data={})
if item.assembly_part is not None:
if item.assembly_part.assemblypart_configdefaultevents.exists():
conf_def_event = item.assembly_part.assemblypart_configdefaultevents.first()
names = ConfigName.objects.filter(config_name_event = item.part.part_confignameevents.first(), config_type ='conf')
for name in names:
try:
default_value = ConfigDefault.objects.get(conf_def_event = conf_def_event, config_name = name).default_value
except ConfigDefault.DoesNotExist:
default_value = None
ConfigValue.objects.create(
config_event = config_event,
config_name = name,
config_value = default_value,
)



Expand Down

0 comments on commit fc103b5

Please sign in to comment.