'Automatically import a directory tree full of distribution files.
mirror_url can be a string that represents a path, a user@host
syntax for SSH, or an rsync:// address.  If mirror_url is a
filesystem path and mirroring is not desired, set network_root
to something like "nfs://path/to/mirror_url/root"'

def import_tree(self, mirror_url, mirror_name, network_root=None, autoinstall_file=None, rsync_flags=None, arch=None, breed=None, os_version=None, logger=None):

    self.log('import_tree', [mirror_url, mirror_name, network_root, autoinstall_file, rsync_flags])
    if ((mirror_url is None) or (not mirror_url)):
        self.log('import    failed.        no    --path    specified')
        return False
    if ((mirror_name is None) or (not mirror_name)):
        self.log('import    failed.        no    --name    specified')
        return False
    path = os.path.normpath(('%s/distro_mirror/%s' % (self.settings().webdir, mirror_name)))
    if (arch is not None):
        arch = arch.lower()
        if (arch == 'x86'):
            arch = 'i386'
        if (path.split('-')[(-1)] != arch):
            path += ('-%s' % arch)
    self.log('importing    from    a    network    location,    running    rsync    to    fetch    the    files    first')
    utils.mkdir(path)
    if (not mirror_url.endswith('/')):
        mirror_url = ('%s/' % mirror_url)
    if (mirror_url.startswith('http://') or mirror_url.startswith('https://') or mirror_url.startswith('ftp://') or mirror_url.startswith('nfs://')):
        self.log('unsupported    protocol')
        return False
    else:
        spacer = ''
        if ((not mirror_url.startswith('rsync://')) and (not mirror_url.startswith('/'))):
            spacer = '    -e    "ssh"    '
        rsync_cmd = RSYNC_CMD
        if rsync_flags:
            rsync_cmd += ('    ' + rsync_flags)
        if (network_root is not None):
            rsync_cmd += '    --include-from=/etc/cobbler/import_rsync_whitelist'
        utils.run_this(rsync_cmd, (spacer, mirror_url, path), self.logger)
    if (network_root is not None):
        if (not network_root.endswith('/')):
            network_root += '/'
        valid_roots = ['nfs://', 'ftp://', 'http://', 'https://']
        for valid_root in valid_roots:
            if network_root.startswith(valid_root):
                break
        else:
            self.log('Network    root    given    to    --available-as    must    be    nfs://,    ftp://,    http://,    or    https://')
            return False
        if network_root.startswith('nfs://'):
            try:
                (a, b, rest) = network_root.split(':', 3)
            except:
                self.log('Network    root    given    to    --available-as    is    missing    a    colon,    please    see    the    manpage    example.')
                return False
    import_module = self.get_module_by_name('manage_import_signatures').get_import_manager(self._collection_mgr, logger)
    import_module.run(path, mirror_name, network_root, autoinstall_file, arch, breed, os_version)
