# Path: vcontrol/rest/helpers/get_allowed.py
# def get_allowed():
#     rest_url = ""
#     if "ALLOW_ORIGIN" in os.environ:
#         allow_origin = os.environ["ALLOW_ORIGIN"]
#         host_port = allow_origin.split("//")[1]
#         host = host_port.split(":")[0]
#         port = str(int(host_port.split(":")[1])+1)
#         rest_url = host+":"+port
#     else:
#         allow_origin = ""
#     return allow_origin, rest_url


from ..helpers import get_allowed
import os
import web


class RemoveProviderR:
    """
    This endpoint allows for removing a provider such as openstack or vmware.
    A Vent machine runs on a provider, this will not remove existing Vent
    machines on the specified provider. Note that a provider can only be
    removed from localhost of the machine running vcontrol unless the
    environment variable VCONTROL_OPEN=true is set on the server.
    """

# Path: vcontrol/rest/helpers/get_allowed.py
# def get_allowed():
#     rest_url = ""
#     if "ALLOW_ORIGIN" in os.environ:
#         allow_origin = os.environ["ALLOW_ORIGIN"]
#         host_port = allow_origin.split("//")[1]
#         host = host_port.split(":")[0]
#         port = str(int(host_port.split(":")[1])+1)
#         rest_url = host+":"+port
#     else:
#         allow_origin = ""
#     return allow_origin, rest_url


# Path: vcontrol/rest/providers/remove.py
from ..helpers import get_allowed
import os
import web



class RemoveProviderR:
    """
    This endpoint allows for removing a provider such as openstack or vmware.
    A Vent machine runs on a provider, this will not remove existing Vent
    machines on the specified provider. Note that a provider can only be
    removed from localhost of the machine running vcontrol unless the
    environment variable VCONTROL_OPEN=true is set on the server.
    """

    allow_origin, rest_url = get_allowed.get_allowed()