Exemplo n.º 1
0
    def run_server(self):
        """

        to run the server

        """

        db_status = config.check_db()
        if db_status == 1:
            result = shell_ask.query_yes_no_quit(" \n_______________________________________________________________\n"
                                                 "   Do you want to purge all databases (DB  reinitialization)?", "no")
            if result == 'yes':
                config.purge_PyOCNI_db()

            print ("\n______________________________________________________________________________________\n"
                   "The OCNI server is running at: " + config.OCNI_IP + ":" + config.OCNI_PORT)
            wsgi.server(eventlet.listen((config.OCNI_IP, int(config.OCNI_PORT))), self.app)
            print ("\n______________________________________________________________________________________\n"
                   "Closing correctly PyOCNI server ")
        else:
            print ("\n______________________________________________________________________________________\n"
                   "The Database is OFF. Please start it before running pyOCNI.")
Exemplo n.º 2
0
               'Accepted': 202,
               'Bad Request': 400,
               'Unauthorized': 401,
               'Forbidden': 403,
               'Method Not Allowed': 405,
               'Conflict': 409,
               'Gone': 410,
               'Unsupported Media Type': 415,
               'Internal Server Error': 500,
               'Not Implemented': 501,
               'Service Unavailable': 503}

# ======================================================================================
# Reinialization of the locations registry and objects registry (clear ZODB)
# ======================================================================================
result = shell_ask.query_yes_no_quit(" \n_______________________________________________________________\n"
                                     "   Do you want to purge 'locations' and 'objects' Databases (DB  reinialization)?", "no")
if result == 'yes':
    location_registry().purge_locations_db()
    location_registry().purge_objects_db()


# ======================================================================================
# the category registry
# ======================================================================================

#category_registry = category_registry()

# register OCCI Core kinds
#category_registry().register_kind(Entity._kind)
#category_registry().register_kind(Resource._kind)
#category_registry().register_kind(Link._kind)
Exemplo n.º 3
0
    'Unauthorized': 401,
    'Forbidden': 403,
    'Method Not Allowed': 405,
    'Conflict': 409,
    'Gone': 410,
    'Unsupported Media Type': 415,
    'Internal Server Error': 500,
    'Not Implemented': 501,
    'Service Unavailable': 503
}

# ======================================================================================
# Reinialization of the locations registry and objects registry (clear ZODB)
# ======================================================================================
result = shell_ask.query_yes_no_quit(
    " \n_______________________________________________________________\n"
    "   Do you want to purge 'locations' and 'objects' Databases (DB  reinialization)?",
    "no")
if result == 'yes':
    location_registry().purge_locations_db()
    location_registry().purge_objects_db()

# ======================================================================================
# the category registry
# ======================================================================================

#category_registry = category_registry()

# register OCCI Core kinds
#category_registry().register_kind(Entity._kind)
#category_registry().register_kind(Resource._kind)
#category_registry().register_kind(Link._kind)