¡@

Home 

OpenStack Study: __init__.py

OpenStack Index

**** CubicPower OpenStack Study ****

def ctrl_conn_to_str(conn):

    """Returns a string representing a connection URL to the controller."""

    if isinstance(conn, httplib.HTTPSConnection):

        proto = "https://"

    elif isinstance(conn, httplib.HTTPConnection):

        proto = "http://"

    else:

        raise TypeError(_('Invalid connection type: %s') % type(conn))

    return "%s%s:%s" % (proto, conn.host, conn.port)