download_ssh_commands view, deprecated
[plstackapi.git] / planetstack / model_policies / model_policy_Image.py
1 def handle(image):
2     from core.models import Controller, ControllerImages, Image
3     from collections import defaultdict
4
5     controller_images = ControllerImages.objects.filter(image=image)
6     existing_controllers = [cs.controller for cs in controller_images] 
7     
8     all_controllers = Controller.objects.all() 
9     for controller in all_controllers:
10         if controller not in existing_controllers:
11             sd = ControllerImages(image=image, controller=controller)
12             sd.save()
13