Ejemplo n.º 1
0
def _mod_delete():
    """Remove OnRamp educational module from environment.

    Usage: ./onramp_pce_service.py moddelete [-h] [-v] mod_id

    positional arguments:
      mod_id         Id of the module

      optional arguments:
        -h, --help     show this help message and exit
        -v, --verbose  increase output verbosity

    """
    descrip = 'Remove OnRamp educational module from environment'
    parser = argparse.ArgumentParser(prog='onramp_pce_service.py moddelete',
                                     description=descrip)
    parser.add_argument('-v', '--verbose', action='store_true',
                        help='increase output verbosity')
    parser.add_argument('mod_id', help='Id of the module', type=int)
    args = parser.parse_args(args=sys.argv[2:])

    result, msg = init_module_delete(args.mod_id)

    if result != 0:
        sys.stderr.write(msg + '\n')
    else:
        print msg

    sys.exit(result)
Ejemplo n.º 2
0
def _mod_delete():
    """Remove OnRamp educational module from environment.

    Usage: ./onramp_pce_service.py moddelete [-h] [-v] mod_id

    positional arguments:
      mod_id         Id of the module

      optional arguments:
        -h, --help     show this help message and exit
        -v, --verbose  increase output verbosity

    """
    descrip = 'Remove OnRamp educational module from environment'
    parser = argparse.ArgumentParser(prog='onramp_pce_service.py moddelete',
                                     description=descrip)
    parser.add_argument('-v',
                        '--verbose',
                        action='store_true',
                        help='increase output verbosity')
    parser.add_argument('mod_id', help='Id of the module', type=int)
    args = parser.parse_args(args=sys.argv[2:])

    result, msg = init_module_delete(args.mod_id)

    if result != 0:
        sys.stderr.write(msg + '\n')
    else:
        print msg

    sys.exit(result)
Ejemplo n.º 3
0
    def DELETE(self, id, **kwargs):
        """Delete a specific module.

        Args:
            id (str): Id of the module to delete.

        Kwargs:
            **kwargs (dict): HTTP query-string parameters. Not currently used.

        Returns:
            OnRamp formatted dict containing request results.
        """
        self.log_call('DELETE')

        # Verify id and initiate deployment.
        try:
            mod_id = int(id)
        except:
            cherrypy.response.status = 400
            msg = 'Invalid module id in url: %s' % id
            self.logger.warn(msg)
            return self.get_response(status_code=-8, status_msg=msg)

        # Delete the resource.
        result = init_module_delete(mod_id)
        return self.get_response(status_msg=result[1])
Ejemplo n.º 4
0
    def DELETE(self, id, **kwargs):
        """Delete a specific module.

        Args:
            id (str): Id of the module to delete.

        Kwargs:
            **kwargs (dict): HTTP query-string parameters. Not currently used.

        Returns:
            OnRamp formatted dict containing request results.
        """
        self.log_call("DELETE")

        # Verify id and initiate deployment.
        try:
            mod_id = int(id)
        except:
            cherrypy.response.status = 400
            msg = "Invalid module id in url: %s" % id
            self.logger.warn(msg)
            return self.get_response(status_code=-8, status_msg=msg)

        # Delete the resource.
        result = init_module_delete(mod_id)
        return self.get_response(status_msg=result[1])