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

Refs #33147 - Allow Auth token without Auth URL #9529

Merged
merged 1 commit into from Aug 9, 2021
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 app/models/katello/repository.rb
Expand Up @@ -413,7 +413,7 @@ def full_path(smart_proxy = nil, force_http = false)
elsif ostree?
"#{scheme}://#{pulp_uri.host.downcase}/pulp/content/web/#{relative_path}"
elsif ansible_collection?
"#{scheme}://#{pulp_uri.host.downcase}/pulp_ansible/galaxy/#{relative_path}/api"
"#{scheme}://#{pulp_uri.host.downcase}/pulp_ansible/galaxy/#{relative_path}/api/"
else
Copy link
Member Author

Choose a reason for hiding this comment

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

Allows users to copy paste this path as remote for other pulp instance, (ex: hub) with a trailing slash.

"#{scheme}://#{pulp_uri.host.downcase}/pulp/content/#{relative_path}/"
end
Expand Down
6 changes: 2 additions & 4 deletions app/models/katello/root_repository.rb
Expand Up @@ -283,9 +283,7 @@ def ensure_valid_auth_url_token
return
end

if self.ansible_collection_auth_url.blank?
errors.add(:base, N_("Auth token requires Auth URL be set."))
elsif !self.ansible_collection_auth_token
if !self.ansible_collection_auth_url.blank? && self.ansible_collection_auth_token.blank?
errors.add(:base, N_("Auth URL requires Auth token be set."))
end
end
Expand Down Expand Up @@ -351,7 +349,7 @@ def pulp_update_needed?
ssl_ca_cert_id ssl_client_cert_id ssl_client_key_id http_proxy_policy http_proxy_id download_concurrency)
changeable_attributes += %w(name container_repository_name docker_tags_whitelist) if docker?
changeable_attributes += %w(deb_releases deb_components deb_architectures gpg_key_id) if deb?
changeable_attributes += %w(ansible_collection_requirements) if ansible_collection?
changeable_attributes += %w(ansible_collection_requirements ansible_collection_auth_url ansible_collection_auth_token) if ansible_collection?
changeable_attributes.any? { |key| previous_changes.key?(key) }
end

Expand Down
Expand Up @@ -96,7 +96,7 @@ <h4 translate>Sync Settings</h4>
<input id="requirementFile" type="file" name="file_path" onclick="this.value = null" onchange="angular.element(this).scope().handleFiles(this)"/>
<p bst-alert='info' ng-show="repository.content_type == 'ansible_collection'">
<span translate>
You can upload a requirements.yml file above to auto-fill contents <b>OR</b> paste contents of <a ng-href="https://docs.ansible.com/ansible/devel/dev_guide/collections_tech_preview.html#install-multiple-collections-with-a-requirements-file" target="_blank"> Requirements.yml </a>below.
You can upload a requirements.yml file above to auto-fill contents <b>OR</b> paste contents of <a ng-href="https://docs.ansible.com/ansible/latest/galaxy/user_guide.html#install-multiple-collections-with-a-requirements-file" target="_blank"> Requirements.yml </a>below.
Copy link
Member Author

Choose a reason for hiding this comment

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

Broken link in help text.

</span>
</p>
</dd>
Expand Down
4 changes: 3 additions & 1 deletion test/models/root_repository_test.rb
Expand Up @@ -583,7 +583,9 @@ def test_valid_ansible_collection_auth_params
assert ansible_repo_root.valid?
assert_nil ansible_repo_root.ansible_collection_auth_url
assert_nil ansible_repo_root.ansible_collection_auth_token
assert ansible_repo_root.valid?

ansible_repo_root.ansible_collection_auth_token = '12345'
assert ansible_repo_root.valid? # Should be able to specify token only
end
end

Expand Down