Revision f882a314 snf-occi-server.py

b/snf-occi-server.py
72 72
            raise AttributeError("This action is currently no applicable.")
73 73
        elif action == START:
74 74
            entity.attributes['occi.compute.state'] = 'active'
75
            entity.actions = [STOP, SUSPEND, RESTART]
75 76
            # read attributes from action and do something with it :-)
76 77
            print('Starting virtual machine with id' + entity.identifier)
77 78
        elif action == STOP:
78 79
            entity.attributes['occi.compute.state'] = 'inactive'
80
            entity.actions = [START]
79 81
            # read attributes from action and do something with it :-)
80 82
            print('Stopping virtual machine with id' + entity.identifier)
81 83
        elif action == RESTART:
84
            entity.actions = [STOP, SUSPEND, RESTART]
82 85
            entity.attributes['occi.compute.state'] = 'active'
83 86
            # read attributes from action and do something with it :-)
84 87
            print('Restarting virtual machine with id' + entity.identifier)
85 88
        elif action == SUSPEND:
86 89
            entity.attributes['occi.compute.state'] = 'suspended'
90
            entity.actions = [START]
87 91
            # read attributes from action and do something with it :-)
88 92
            print('Suspending virtual machine with id' + entity.identifier)
89 93

  
......
97 101
        sec_obj = {'username': 'password'}
98 102

  
99 103
        snf = ComputeClient(Config())
104

  
100 105
        images = snf.list_images()
101 106
        for image in images:
102 107
            IMAGE = Mixin("http://schemas.ogf.org/occi/infrastructure#", str(image['name']), [OS_TEMPLATE])
......
110 115
                                 }
111 116
            FLAVOR = Mixin("http://schemas.ogf.org/occi/infrastructure#", str(flavor['name']), [RESOURCE_TEMPLATE], attributes = FLAVOR_ATTRIBUTES)
112 117
            self.register_backend(FLAVOR, MixinBackend())
113
   
118
        
114 119
        
115 120
        
116 121
        return self._call_occi(environ, response, security=sec_obj, foo=None)

Also available in: Unified diff