Example #1
0
    try:
        src_domain = Domain(src_domain_home)
        dst_domain = Domain(dst_domain_home)
        alt_src_domain = alt_src_domain_home and Domain(alt_src_domain_home)
        if not src_domain.is_compatible():
            utils.print_exit(MSG_INCOMPATIBLE_DOMAIN)
        if alt_src_domain and not alt_src_domain.is_compatible():
            utils.print_exit(MSG_INCOMPATIBLE_DOMAIN)

        sources = repo_url or (alt_src_domain or src_domain).get_sources()
        repo = Repository(sources)

        if clone_domain:
            # create new domain
            utils.print_verbose("creating new domain (%s)" % dst_domain_home)
            dst_domain.create(label, sources)

            # populating subdomains
            utils.print_verbose("setting subdomains")
            dst_domain.set_subdomains(src_domain.get_subdomains())

        if clone_installed:
            # populate with installed
            src_installed_map = src_domain.get_packages_with_state("installed")
            for src_package_name, src_package in src_installed_map.items():
                utils.print_verbose("installing package (%s)" %
                                    src_package_name)
                tarf = repo.get(src_package_name)
                if tarf == None:
                    utils.print_warning(
                        "warning: could not find package (%s)" %
Example #2
0
                globls.force = True
            elif arg in ["--verbose"]:
                globls.verbose = True
            #elif arg in ["-y", "--yes"]:
                #globls.auto_yes = True
            else:
                raise Exception()
    except SystemExit:
        raise
    except:
        if globls.debug:
            traceback.print_exc()
        utils.print_exit("error: bad/missing argument(s)")

    # TODO: this does not check properly
    if not domain_home:
        utils.print_exit("error: cannot do a create over an existing domain")

    try:
        domain = Domain(domain_home)
        domain.create(label, repo_source)
    except SystemExit:
        raise
    except utils.SSMExitException, detail:
        utils.print_exit(detail)
    except:
        if globls.debug:
            traceback.print_exc()
        utils.print_exit("error: operation failed")
    sys.exit(0)