Support for Virtual Repositories lost
jniesen opened this issue · 0 comments
jniesen commented
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