Skip to content

Commit

Permalink
Merge pull request #264 from fasrc/ajk_product_fix
Browse files Browse the repository at this point in the history
Fix product creation
  • Loading branch information
claire-peters authored Nov 30, 2023
2 parents 6d8afcc + 3b34e1f commit 47712b3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions coldfront/plugins/ifx/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,13 @@ def resource_post_save(sender, instance, **kwargs):
except ProductResource.DoesNotExist:
# Need to create a Product and ProductResource for this Resource
products = FiineAPI.listProducts(product_name=instance.name)
facility = Facility.objects.get(name='Research Computing Storage')
if not products:
facility = Facility.objects.get(name='Research Computing Storage')
product = create_new_product(product_name=instance.name, product_description=instance.name, facility=facility)
else:
fiine_product = products[0].to_dict()
fiine_product.pop('facility')
fiine_product.pop('object_code_category')
fiine_product['facility'] = facility
fiine_product['billing_calculator'] = 'coldfront.plugins.ifx.calculator.NewColdfrontBillingCalculator'
(product, created) = Product.objects.get_or_create(**fiine_product)
product_resource = ProductResource.objects.create(product=product, resource=instance)
Expand Down
2 changes: 1 addition & 1 deletion container_startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
service redis-server start
python ./manage.py qcluster &
python ./manage.py add_scheduled_tasks
python ./manage.py collectstatic
python ./manage.py collectstatic --noinput
# initial_setup does not appear to work as requested.
python ./manage.py initial_setup &

Expand Down

0 comments on commit 47712b3

Please sign in to comment.