nexus3-cli icon indicating copy to clipboard operation
nexus3-cli copied to clipboard

Issue with Upload path

Open jaredAtVertex opened this issue 4 years ago • 1 comments

This line is preventing files from being uploaded to the proper nexus path when running in windows environment: api/repository/upload.py 22 dst_dir = os.path.normpath(dst_dir or REMOTE_PATH_SEPARATOR)

Removing this line yields expected results, but recognize this line was introduced with https://github.com/thiagofigueiro/nexus3-cli/commit/b2f13211fb7c493fb4187d95e14bc1bac23bdbff

To re-create this issue:

import os
from pathlib import PurePosixPath

from nexuscli import nexus_config, nexus_client
from nexuscli.api import repository
from nexuscli.api.repository import upload
...

def ul_nexus_asset(env_dtl, component, file_name):
    client = instantiate_nexus_client()
    repo = client.repositories.get_by_name("my-nexus-repo")
    dst = str(PurePosixPath("my_root/{}/{}".format(env_dtl, component)))

    files_uploaded = repository.upload.upload_file_raw(repo, str(file_name), dst, file_name.name)

def instantiate_nexus_client():
    config = nexus_config.NexusConfig(url=NEXUS_URL,
                                      username='someuser',
                                      password='z@nyPa$sword')
    client = nexus_client.NexusClient(config=config)
    client.repositories.refresh()
    return client

uploaded file will get uploaded but does not upload to a directory: In nexus the component group is created as /my_root \ environ \ component instead of /my_root / environ / component (which is what get's created when you upload a component directly in nexus)

jaredAtVertex avatar Apr 06 '20 17:04 jaredAtVertex

edit: mixed-up my comments

thiagofigueiro avatar Apr 10 '20 00:04 thiagofigueiro