Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Virtual Repositories lost #108

Open
jniesen opened this issue Apr 4, 2019 · 0 comments
Open

Support for Virtual Repositories lost #108

jniesen opened this issue Apr 4, 2019 · 0 comments

Comments

@jniesen
Copy link

jniesen commented Apr 4, 2019

Describe the problem

A virtual repo cannot be configured properly because there is no attribute on the Resource::Repository class that supports setting repositories.

Software Version

Ruby: 2.5.1p57
Artifactory Gem: 3.0.0

Stacktrace

Failure/Error:
  virtual_repo = Artifactory::Resource::Repository.new(
    key:          'cots-test-gems',
    rclass:       'virtual',
    package_type: 'gems',
    repositories: ['cots-test-gems-local', 'cots-test-gems-remote']
  ).save

NoMethodError:
  undefined method `repositories' for #<Artifactory::Resource::Repository:0x000055b9a4e21f90>
# ./vendor/bundle/ruby/2.5.0/gems/artifactory-3.0.0/lib/artifactory/resources/base.rb:309:in `block in to_hash'
# ./vendor/bundle/ruby/2.5.0/gems/artifactory-3.0.0/lib/artifactory/resources/base.rb:307:in `each'
# ./vendor/bundle/ruby/2.5.0/gems/artifactory-3.0.0/lib/artifactory/resources/base.rb:307:in `inject'
# ./vendor/bundle/ruby/2.5.0/gems/artifactory-3.0.0/lib/artifactory/resources/base.rb:307:in `to_hash'
# ./vendor/bundle/ruby/2.5.0/gems/artifactory-3.0.0/lib/artifactory/resources/base.rb:324:in `to_json'
# ./vendor/bundle/ruby/2.5.0/gems/artifactory-3.0.0/lib/artifactory/resources/repository.rb:102:in `save'
# ./spec/artifacts/rubygems_spec.rb:24:in `<top (required)>'

Possible Solution

Make sure that there is parity between the Resource::Respository class attributes and the properties required by the support JSON schemas:

    def content_type
      case rclass.to_s.downcase
      when "local"
        "application/vnd.org.jfrog.artifactory.repositories.LocalRepositoryConfiguration+json"
      when "remote"
        "application/vnd.org.jfrog.artifactory.repositories.RemoteRepositoryConfiguration+json"
      when "virtual"
        "application/vnd.org.jfrog.artifactory.repositories.VirtualRepositoryConfiguration+json"
      else
        raise "Unknown Repository type `#{rclass}'!"
      end
    end
@jniesen jniesen mentioned this issue Apr 4, 2019
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant