# Path: ceph_deploy/util/net.py
# LOG = logging.getLogger(__name__)
# def get_nonlocal_ip(host, subnet=None):
# def ip_in_subnet(ip, subnet):
# def in_subnet(cidr, addrs=None):
# def ip_addresses(conn, interface=None, include_loopback=False):
# def linux_interfaces(conn):
# def _interfaces_ip(out):
#     def parse_network(value, cols):
# def _interfaces_ifconfig(out):
# def _number_of_set_bits_to_ipv4_netmask(set_bits):  # pylint: disable=C0103
# def _number_of_set_bits(x):
# def cidr_to_ipv4_netmask(cidr_bits):
# def get_request(url):
# def get_chacra_repo(shaman_url):


    from urllib.parse import urlparse
    from urlparse import urlparse
from ceph_deploy.util.paths import gpg
from ceph_deploy.util import net
import logging
def install(distro, version_kind, version, adjust_repos, **kw):
    packages = kw.pop('components', [])
    codename = distro.codename
    machine = distro.machine_type
    extra_install_flags = []

    if version_kind in ['stable', 'testing']:
        key = 'release'
    else:
        key = 'autobuild'

    distro.packager.clean()
    distro.packager.install(['ca-certificates', 'apt-transport-https'])

    if adjust_repos:
        # Wheezy does not like the download.ceph.com SSL cert
        protocol = 'https'
        if codename == 'wheezy':
            protocol = 'http'

        if version_kind in ['dev', 'dev_commit']:
            shaman_url = 'https://shaman.ceph.com/api/repos/ceph/{version}/{sha1}/{distro}/{distro_version}/repo/?arch={arch}'.format(
                distro=distro.normalized_name,
                distro_version=distro.codename,
                version=kw['args'].dev,
                sha1=kw['args'].dev_commit or 'latest',
                arch=machine
                )
            LOG.debug('fetching repo information from: %s' % shaman_url)
            chacra_url = net.get_request(shaman_url).geturl()

# Path: ceph_deploy/util/net.py
# LOG = logging.getLogger(__name__)
# def get_nonlocal_ip(host, subnet=None):
# def ip_in_subnet(ip, subnet):
# def in_subnet(cidr, addrs=None):
# def ip_addresses(conn, interface=None, include_loopback=False):
# def linux_interfaces(conn):
# def _interfaces_ip(out):
#     def parse_network(value, cols):
# def _interfaces_ifconfig(out):
# def _number_of_set_bits_to_ipv4_netmask(set_bits):  # pylint: disable=C0103
# def _number_of_set_bits(x):
# def cidr_to_ipv4_netmask(cidr_bits):
# def get_request(url):
# def get_chacra_repo(shaman_url):


# Path: ceph_deploy/hosts/debian/install.py
    from urllib.parse import urlparse
    from urlparse import urlparse
from ceph_deploy.util.paths import gpg
from ceph_deploy.util import net
import logging

def install(distro, version_kind, version, adjust_repos, **kw):
    packages = kw.pop('components', [])
    codename = distro.codename
    machine = distro.machine_type
    extra_install_flags = []

    if version_kind in ['stable', 'testing']:
        key = 'release'
    else:
        key = 'autobuild'

    distro.packager.clean()
    distro.packager.install(['ca-certificates', 'apt-transport-https'])

    if adjust_repos:
        # Wheezy does not like the download.ceph.com SSL cert
        protocol = 'https'
        if codename == 'wheezy':
            protocol = 'http'

        if version_kind in ['dev', 'dev_commit']:
            shaman_url = 'https://shaman.ceph.com/api/repos/ceph/{version}/{sha1}/{distro}/{distro_version}/repo/?arch={arch}'.format(
                distro=distro.normalized_name,
                distro_version=distro.codename,
                version=kw['args'].dev,
                sha1=kw['args'].dev_commit or 'latest',
                arch=machine
                )
            LOG.debug('fetching repo information from: %s' % shaman_url)
            chacra_url = net.get_request(shaman_url).geturl()

            content = net.get_chacra_repo(shaman_url)