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

Fixes #18076 - Can set OSTree repo depth #184

Merged
merged 1 commit into from Feb 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -5,7 +5,7 @@

Exposing Pulp's juiciest parts. http://www.pulpproject.org/

Latest Live Tested Version: **pulp-server-2.8.3-0.1.beta.el7.noarch**
Latest Live Tested Version: **pulp-server-2.11.0-1.el7.noarch**

Current stable Runcible: https://github.com/Katello/runcible/tree/0.3

Expand Down
2 changes: 1 addition & 1 deletion lib/runcible/models/ostree_importer.rb
Expand Up @@ -4,7 +4,7 @@ class OstreeImporter < Importer
ID = 'ostree_web_importer'.freeze
REPO_TYPE = 'OSTREE'.freeze

attr_accessor 'branches'
attr_accessor 'branches', 'depth'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should depth have a default value? or is nil okay and what does nil signify? everything?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jlsherrill good question. I guess on the katlelo side I am setting it to 0 by default so never noticed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jlsherrill found the answer

> Runcible::Models::OstreeImporter.new(:depth => 10).config
=> {"depth"=>10}
> Runcible::Models::OstreeImporter.new(:feed => "http://ostree-house.org").config
=> {"feed"=>"http://ostree-house.org"}

> gg=Runcible::Models::OstreeImporter.new()
=> #<Runcible::Models::OstreeImporter:0x00000001403b88>
> gg.depth = 1
=> 1
gg.config
=> {"depth"=>1}
> gg.depth=nil
=> nil
> gg.config
=> {"depth"=>nil}

In short unless you forcibly set depth to nil, its going to work ok. Pulp will not get set the depth value if you don't provide the importer one. So imo no defaults are needed here.


def id
OstreeImporter::ID
Expand Down
3 changes: 3 additions & 0 deletions test/extensions/ostree_repository_test.rb
Expand Up @@ -85,12 +85,15 @@ def test_create_with_importer_and_distributors
def test_create_with_importer_and_distributors_objects
distributors = [Runcible::Models::OstreeDistributor.new(:id => '123')]
importer = Runcible::Models::OstreeImporter.new
depth = -1
importer.depth = depth
response = @extension.create_with_importer_and_distributors(RepositorySupport.repo_id, importer, distributors)
assert_equal 201, response.code

response = @extension.retrieve(RepositorySupport.repo_id, :details => true)
assert_equal RepositorySupport.repo_id, response['id']
assert_equal 'ostree_web_importer', response['importers'].first['importer_type_id']
assert_equal depth, response['importers'].first['config']['depth']
end
end

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.