Exemplo n.º 1
0
 def link(self, id): # fixme(jorgesece): manage it with parameters list
     """Put link resources
     :param id: identificator
     """
     linked = []
     link_err = []
     try:
         path = '%s/%s/%s' % (self.default_path, self.resource, id)
         result = self.os_helper.put(path)
         result = parsers.parse_controller_delete("statisfully linked", id, result)
         linked.append(result)
     except TypeError:
         result = parsers.parse_controller_delete("ERROR", "Undefined", "Bad attribute definition for OS")
         link_err.append(result)
     except Exception as e:
         result = parsers.parse_controller_err(id, e.message)
         link_err.append(result)
     return linked, link_err
Exemplo n.º 2
0
 def delete(self, parameters):
     """delete resources which satisfy the parameters
     :param parameters:
     """
     deleted = []
     deleted_err = []
     for param in parameters:
         try:
             path = '%s/%s/%s' % (self.default_path, self.resource, param['id'])
             result = self.os_helper.delete(path)
             result = parsers.parse_controller_delete("statisfully deleted", param['id'], result)
             deleted.append(result)
         except TypeError:
             result = parsers.parse_controller_delete("ERROR", "Undefined", "Bad attribute definition for OS")
             deleted_err.append(result)
         except Exception as e:
             result = parsers.parse_controller_delete("ERROR",param['id'], e.message)
             deleted_err.append(result)
     return deleted, deleted_err