https://pulp.plan.io/https://pulp.plan.io/favicon.ico2016-04-29T16:57:16ZPulpPulp - Issue #1865: Error searching rpm repositories by fields using dot notationhttps://pulp.plan.io/issues/1865?journal_id=111112016-04-29T16:57:16Zbmbouterbmbouter@redhat.com
<ul></ul><p>I agree this is an issue; I've reproduced it. Here are some details:</p>
<p>In my vanilla Vagrant environment there are 4 repos. The rpm repo looks like this from db.repos.find()</p>
<pre><code>{
"_id" : ObjectId("57220e7ce779890a1bd0d311"),
"repo_id" : "zoo",
"notes" : {
"_repo-type" : "rpm-repo"
},
"scratchpad" : {
},
"content_unit_counts" : {
},
"_ns" : "repos"
}
</code></pre>
<p>In there we should be able to search on the field notes._repo-type I'm able to also do that in my db:</p>
<pre><code>> db.repos.find({}, {'notes._repo-type': 1})
{ "_id" : ObjectId("57220e7be779890a1c1e2bfb"), "notes" : { "_repo-type" : "docker-repo" } }
{ "_id" : ObjectId("57220e7ce779890a1d75f848"), "notes" : { "_repo-type" : "docker-repo" } }
{ "_id" : ObjectId("57220e7ce779890a1bd0d311"), "notes" : { "_repo-type" : "rpm-repo" } }
{ "_id" : ObjectId("57220e7de779890a1d75f84c"), "notes" : { "_repo-type" : "puppet-repo" } }
{ "_id" : ObjectId("57220e7de779890a1c1e2bff"), "notes" : { "_repo-type" : "PYTHON" } }
</code></pre>
<p>I then try to do the same with pulp-admin:</p>
<pre><code>pulp-admin -vv rpm repo search --fields notes._repo-type
</code></pre>
<p>Which returns the error message:</p>
<pre><code>Invalid properties: ['Field: <notes._repo-type> does not exist on objects in the
<repos> collection']
</code></pre>
<p>The above pulp-admin command is producing this API request:</p>
<pre><code>POST request to /pulp/api/v2/repositories/search/ with parameters {"criteria": {"sort": null, "fields": ["notes._repo-type"], "limit": null, "filters": {"notes._repo-type": "rpm-repo"}, "skip": null}}
</code></pre>
<p>I can have httpie perform the same request:</p>
<pre><code>http --verify no --auth admin:admin POST https://localhost/pulp/api/v2/repositories/search/ criteria:='{"sort": null, "fields": ["notes._repo-type"], "limit": null, "filters": {"notes._repo-type": "rpm-repo"}, "skip": null}'
</code></pre>
<p>This simplified version also fails with the same error:</p>
<pre><code>http --verify no --auth admin:admin POST https://localhost/pulp/api/v2/repositories/search/ criteria:='{"fields": ["notes._repo-type"], "filters": {"notes._repo-type": "rpm-repo"}}'
</code></pre>
<p>Both of these work as expected indicating that the filters section is working correctly.</p>
<pre><code>http --verify no --auth admin:admin POST https://localhost/pulp/api/v2/repositories/search/ criteria:='{"fields": ["notes"], "filters": {"notes._repo-type": "rpm-repo"}}'
http --verify no --auth admin:admin POST https://localhost/pulp/api/v2/repositories/search/ criteria:='{"filters": {"notes._repo-type": "rpm-repo"}}'
</code></pre>
<p>The bottom one corresponds with the pulp-admin command which also works as expected:</p>
<pre><code>pulp-admin -vv rpm repo search --filters '{"notes._repo-type": "rpm-repo"}'
</code></pre>
<p>The above command produces the following API call:</p>
<pre><code>POST request to /pulp/api/v2/repositories/search/ with parameters {"criteria": {"sort": null, "fields": null, "limit": null, "filters": {"notes._repo-type": "rpm-repo"}, "skip": null}}
</code></pre> Pulp - Issue #1865: Error searching rpm repositories by fields using dot notationhttps://pulp.plan.io/issues/1865?journal_id=111122016-04-29T17:19:08Zbmbouterbmbouter@redhat.com
<ul></ul><p>I see two issues here.</p>
<p>1. The bug as reported is legitimate and is an error on the server side.</p>
<p>2. The specification of --fields causes --filters to also be set. This does not make sense to me. Perhaps that's expected? I would like other input on if this should be filed as a separate pulp bug against pulp-admin in pulp_rpm?</p> Pulp - Issue #1865: Error searching rpm repositories by fields using dot notationhttps://pulp.plan.io/issues/1865?journal_id=111152016-04-29T18:23:32Zamacdona@redhat.comaustin@redhat.com
<ul></ul><p>The offending line is <a href="https://github.com/pulp/pulp/blob/6d25a13e993efc5f447a29ea8e8490dc1d812b74/server/pulp/server/webservices/views/serializers/__init__.py#L301" class="external">https://github.com/pulp/pulp/blob/6d25a13e993efc5f447a29ea8e8490dc1d812b74/server/pulp/server/webservices/views/serializers/__init__.py#L301</a></p>
<p>What is happening here that we are checking to see if the field being passed needs to be translated to match the internal db representation. This line assumes that the field passed is a legitimate field, but it fails to take "dot notation" into account. The correct behavior would be to split the field names on "." and translate only the field name, not the inner name. (We are not using translate to change the key name within a DictField.)</p> Pulp - Issue #1865: Error searching rpm repositories by fields using dot notationhttps://pulp.plan.io/issues/1865?journal_id=113362016-05-06T14:35:57Zdkliban@redhat.com
<ul><li><strong>Priority</strong> changed from <i>Normal</i> to <i>High</i></li><li><strong>Severity</strong> changed from <i>2. Medium</i> to <i>3. High</i></li><li><strong>Platform Release</strong> set to <i>2.8.4</i></li><li><strong>Triaged</strong> changed from <i>No</i> to <i>Yes</i></li></ul> Pulp - Issue #1865: Error searching rpm repositories by fields using dot notationhttps://pulp.plan.io/issues/1865?journal_id=113692016-05-06T17:34:10Zsemyerssean.myers@redhat.com
<ul><li><strong>Status</strong> changed from <i>NEW</i> to <i>POST</i></li><li><strong>Assignee</strong> set to <i>alanoe</i></li></ul><p>alanoe submitted a PR for review (thanks!)<br>
<a href="https://github.com/pulp/pulp/pull/2562" class="external">https://github.com/pulp/pulp/pull/2562</a></p> Pulp - Issue #1865: Error searching rpm repositories by fields using dot notationhttps://pulp.plan.io/issues/1865?journal_id=117632016-05-26T19:09:42Zsemyerssean.myers@redhat.com
<ul><li><strong>Platform Release</strong> changed from <i>2.8.4</i> to <i>2.8.5</i></li></ul> Pulp - Issue #1865: Error searching rpm repositories by fields using dot notationhttps://pulp.plan.io/issues/1865?journal_id=124282016-06-17T16:46:32Zsemyerssean.myers@redhat.com
<ul><li><strong>Platform Release</strong> changed from <i>2.8.5</i> to <i>2.8.6</i></li></ul> Pulp - Issue #1865: Error searching rpm repositories by fields using dot notationhttps://pulp.plan.io/issues/1865?journal_id=126402016-06-27T16:59:30Zsemyerssean.myers@redhat.com
<ul><li><strong>Platform Release</strong> deleted (<del><i>2.8.6</i></del>)</li></ul> Pulp - Issue #1865: Error searching rpm repositories by fields using dot notationhttps://pulp.plan.io/issues/1865?journal_id=221692017-10-02T14:56:13Zdalleydalley@redhat.com
<ul><li><strong>Status</strong> changed from <i>POST</i> to <i>NEW</i></li><li><strong>Priority</strong> changed from <i>High</i> to <i>Normal</i></li></ul><p>Since this PR still has unaddressed issues and has been untouched for a year, it has been closed.</p>
<p>Hopefully it can be picked back up again later.</p> Pulp - Issue #1865: Error searching rpm repositories by fields using dot notationhttps://pulp.plan.io/issues/1865?journal_id=221702017-10-02T14:56:32Zdalleydalley@redhat.com
<ul><li><strong>Assignee</strong> deleted (<del><i>alanoe</i></del>)</li></ul> Pulp - Issue #1865: Error searching rpm repositories by fields using dot notationhttps://pulp.plan.io/issues/1865?journal_id=368902019-04-12T19:34:16Zbmbouterbmbouter@redhat.com
<ul><li><strong>Status</strong> changed from <i>NEW</i> to <i>CLOSED - WONTFIX</i></li></ul> Pulp - Issue #1865: Error searching rpm repositories by fields using dot notationhttps://pulp.plan.io/issues/1865?journal_id=369872019-04-12T19:40:05Zbmbouterbmbouter@redhat.com
<ul></ul><p>Pulp 2 is approaching maintenance mode, and this Pulp 2 ticket is not being actively worked on. As such, it is being closed as WONTFIX. Pulp 2 is still accepting contributions though, so if you want to contribute a fix for this ticket, please reopen or comment on it. If you don't have permissions to reopen this ticket, or you want to discuss an issue, please reach out via the <a href="https://www.redhat.com/mailman/listinfo/pulp-dev" class="external">developer mailing list</a>.</p> Pulp - Issue #1865: Error searching rpm repositories by fields using dot notationhttps://pulp.plan.io/issues/1865?journal_id=389662019-04-15T20:31:30Zbmbouterbmbouter@redhat.com
<ul><li><strong>Tags</strong> <i>Pulp 2</i> added</li></ul>