Esempio n. 1
0
    def finalize_options(self):
        repo_details = repo_detail.read_options(
            repo_base_url=self.repo_base_url,
            repo_push_id=self.repo_push_id,
            username=self.repo_user,
            password=self.repo_pass)

        self.announce(
            'Repository details: '
            'repo_base_url="{}", '
            'repo_push_id="{}" '
            'username="******"'.format(
                repo_details.repo_base_url,
                repo_details.repo_push_id,
                repo_details.username),
            level=log.INFO
        )

        self._check_repo_details(repo_details)

        verify_cert = not self.no_cert_verify

        path = compute_repo_path_from_module_name(
            self.distribution.metadata.name)

        self.upload = partial(
            self.__upload,
            repo_base_url=repo_details.repo_base_url,
            repo_push_id=repo_details.repo_push_id,
            path=path,
            username=repo_details.username,
            password=repo_details.password,
            verify_cert=verify_cert)
def test_invalid_repo_pull_id():
    repo_details = read_options()
    determine_checksums(username=repo_details.username,
                        password=repo_details.password,
                        repo_base_url=repo_details.repo_base_url,
                        repo_pull_id="bad-repo-pull-id",
                        file_path=nose_file_path,
                        verify_cert=False)
def test_bad_file_path():
    repo_details = read_options()
    determine_checksums(username=repo_details.username,
                        password=repo_details.password,
                        repo_base_url=repo_details.repo_base_url,
                        repo_pull_id=repo_details.repo_pull_id,
                        file_path="badorg/badmodule/bebad-1.2.3.tar.gz",
                        verify_cert=False)
def test_invalid_password():
    repo_details = read_options()
    determine_checksums(username=repo_details.username,
                        password="******",
                        repo_base_url=repo_details.repo_base_url,
                        repo_pull_id=repo_details.repo_pull_id,
                        file_path=nose_file_path,
                        verify_cert=False)
def test_invalid_username():
    repo_details = read_options()
    determine_checksums(username="******",
                        password=repo_details.password,
                        repo_base_url=repo_details.repo_base_url,
                        repo_pull_id=repo_details.repo_pull_id,
                        file_path=nose_file_path,
                        verify_cert=False)
Esempio n. 6
0
def test_bad_file_path():
    repo_details = read_options()
    determine_checksums(username=repo_details.username,
                        password=repo_details.password,
                        repo_base_url=repo_details.repo_base_url,
                        repo_pull_id=repo_details.repo_pull_id,
                        file_path="badorg/badmodule/bebad-1.2.3.tar.gz",
                        verify_cert=False)
Esempio n. 7
0
def test_invalid_repo_pull_id():
    repo_details = read_options()
    determine_checksums(username=repo_details.username,
                        password=repo_details.password,
                        repo_base_url=repo_details.repo_base_url,
                        repo_pull_id="bad-repo-pull-id",
                        file_path=nose_file_path,
                        verify_cert=False)
Esempio n. 8
0
def test_invalid_password():
    repo_details = read_options()
    determine_checksums(username=repo_details.username,
                        password="******",
                        repo_base_url=repo_details.repo_base_url,
                        repo_pull_id=repo_details.repo_pull_id,
                        file_path=nose_file_path,
                        verify_cert=False)
Esempio n. 9
0
def test_invalid_username():
    repo_details = read_options()
    determine_checksums(username="******",
                        password=repo_details.password,
                        repo_base_url=repo_details.repo_base_url,
                        repo_pull_id=repo_details.repo_pull_id,
                        file_path=nose_file_path,
                        verify_cert=False)
    def run(self):
        module_id = self._determine_module_id()
        self.announce(
            'Creating module_info file for module: {}'.format(module_id),
            level=log.INFO
        )

        # This command is never used interactively, so it doesn't make
        # sense to add support for passing in repo details like the
        # artifactory_upload command does. If that changes in the future
        # this command can always be enhanced at that time. The work
        # involved to add the options isn't so much in the code changes
        # to this command as in the test coverage that would need to be
        # written. It would also probably require refactoring the
        # commands to share a common base class. All this currently
        # falls under YAGNI (You're Not Going To Need It).

        verify_cert = not self.no_cert_verify
        repo_details = read_options()

        pip_package_path_finder = PipPackagePathFinder()

        def determine_checksums(file_path):
            return artifactory_rest.determine_checksums(
                username=repo_details.username,
                password=repo_details.password,
                repo_pull_id=repo_details.repo_pull_id,
                repo_base_url=repo_details.repo_base_url,
                file_path=file_path,
                verify_cert=verify_cert)

        checksum_dependency_helper = ChecksumDependencyHelper(
            determine_file_path_fn=pip_package_path_finder.determine_file_path,
            determine_checksums_from_file_path_fn=determine_checksums)

        build_info_module_generator = BuildInfoModuleGenerator(
            determine_dependency_checksums_fn=checksum_dependency_helper)

        requirements_file = compute_requirements_filename_full_path(
            artifact_id=module_id.artifact_id,
            version=module_id.version)

        module_info_file = compute_module_info_filename_full_path(
            artifact_id=module_id.artifact_id,
            version=module_id.version)

        build_info_module_generator.update(
            module_id=module_id,
            module_properties={},
            freeze_file=requirements_file,
            dist_files=self.distribution.dist_files,
            module_file=module_info_file,
            force_dependency_rebuild=bool(self.force_dependency_rebuild),
            force_clean=bool(self.force_clean))

        self.announce(
            'Module info file created at: {}'.format(module_info_file),
            level=log.INFO)
def get_deploy_functions(env_info=None, verify_cert=True):
    repo_details = repo_detail.read_options()

    return (
        get_deploy_artifact_function(
            repo_details, env_info=env_info, verify_cert=verify_cert),

        get_deploy_build_info_function(
            repo_details, verify_cert=verify_cert))
Esempio n. 12
0
    def run(self):
        module_id = self._determine_module_id()
        self.announce(
            'Creating module_info file for module: {}'.format(module_id),
            level=log.INFO)

        # This command is never used interactively, so it doesn't make
        # sense to add support for passing in repo details like the
        # artifactory_upload command does. If that changes in the future
        # this command can always be enhanced at that time. The work
        # involved to add the options isn't so much in the code changes
        # to this command as in the test coverage that would need to be
        # written. It would also probably require refactoring the
        # commands to share a common base class. All this currently
        # falls under YAGNI (You're Not Going To Need It).

        verify_cert = not self.no_cert_verify
        repo_details = read_options()

        pip_package_path_finder = PipPackagePathFinder()

        def determine_checksums(file_path):
            return artifactory_rest.determine_checksums(
                username=repo_details.username,
                password=repo_details.password,
                repo_pull_id=repo_details.repo_pull_id,
                repo_base_url=repo_details.repo_base_url,
                file_path=file_path,
                verify_cert=verify_cert)

        checksum_dependency_helper = ChecksumDependencyHelper(
            determine_file_path_fn=pip_package_path_finder.determine_file_path,
            determine_checksums_from_file_path_fn=determine_checksums)

        build_info_module_generator = BuildInfoModuleGenerator(
            determine_dependency_checksums_fn=checksum_dependency_helper)

        requirements_file = compute_requirements_filename_full_path(
            artifact_id=module_id.artifact_id, version=module_id.version)

        module_info_file = compute_module_info_filename_full_path(
            artifact_id=module_id.artifact_id, version=module_id.version)

        build_info_module_generator.update(
            module_id=module_id,
            module_properties={},
            freeze_file=requirements_file,
            dist_files=self.distribution.dist_files,
            module_file=module_info_file,
            force_dependency_rebuild=bool(self.force_dependency_rebuild),
            force_clean=bool(self.force_clean))

        self.announce(
            'Module info file created at: {}'.format(module_info_file),
            level=log.INFO)
def test_typical_usage():
    repo_details = read_options()

    found_checksums = determine_checksums(
        username=repo_details.username,
        password=repo_details.password,
        repo_base_url=repo_details.repo_base_url,
        repo_pull_id=repo_details.repo_pull_id,
        file_path=nose_file_path,
        verify_cert=False)

    eq_(found_checksums.sha1, "02cc3ffdd7a1ce92cbee388c4a9e939a79f66ba5")
    eq_(found_checksums.md5, "735e3f1ce8b07e70ee1b742a8a53585a")
Esempio n. 14
0
def test_typical_usage():
    repo_details = read_options()

    found_checksums = determine_checksums(
        username=repo_details.username,
        password=repo_details.password,
        repo_base_url=repo_details.repo_base_url,
        repo_pull_id=repo_details.repo_pull_id,
        file_path=nose_file_path,
        verify_cert=False)

    eq_(found_checksums.sha1, "02cc3ffdd7a1ce92cbee388c4a9e939a79f66ba5")
    eq_(found_checksums.md5, "735e3f1ce8b07e70ee1b742a8a53585a")