Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix product creation #264

Merged
merged 1 commit into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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