chef/artifactory-client

Get artifact latest version error

xrlin opened this issue · 1 comments

xrlin commented

When i use this gem to get the latest version of an artiface. An error appear. Do i have something wrong in my code? The code and error are shown below.

code

latest_version = Artifact.latest_version(name: 'artifact.apk')
puts latest_version.inspect

error

/home/user/.rvm/gems/ruby-2.3.0/gems/artifactory-2.5.0/lib/artifactory/client.rb:374:in `error': The Artifactory server responded with an HTTP Error 400: `The groupId and artifactId cannot be empty' (Artifactory::Error::HTTPError)
    from /home/user/.rvm/gems/ruby-2.3.0/gems/artifactory-2.5.0/lib/artifactory/client.rb:255:in `block in request'
    from /home/user/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/net/http.rb:853:in `start'
    from /home/user/.rvm/gems/ruby-2.3.0/gems/artifactory-2.5.0/lib/artifactory/client.rb:245:in `request'
    from /home/user/.rvm/gems/ruby-2.3.0/gems/artifactory-2.5.0/lib/artifactory/client.rb:102:in `get'
    from /home/user/.rvm/gems/ruby-2.3.0/gems/artifactory-2.5.0/lib/artifactory/resources/artifact.rb:355:in `latest_version'
    from artifactory_test.rb:12:in `<main>'

Besides, the artifact object's last_modified, local_path, created values are nil but i can get these values from api using curl directly.

The Artifactory server version 4.13.0.

I believe that group is now required when requesting the versions from Artifactory. I ran in to this same error.

latest_version = Artifact.latest_version(name: 'artifact.apk', group: )

When I added group, it fixed the issue.