<p dir="ltr">I have the beginnings of a script in progress that so far works for package name searches.  It was made to iterate over all repos  a user has access to.  It's really slow right now (serial FTL), and there may be bugs other than listed, but hopefully it helps.  Hope the formatting isn't crap, sending from mobile.<br><br></p>
<p dir="ltr">#!/bin/bash<br>
#<br>
#<br>
# Known issues / missing features:<br>
#  - Missing ability to parallelize repo searches, which would really speed things up.  Easy fix: Gnu Parallel, widely compatible fix: bash wait.<br>
#  - Missing ability to speed up searches by limiting scope to just Red Hat and/or just IT repos<br>
#  - Missing option checking and help feedback in the event of bad input<br>
#  - Missing ability to limit number of matches returned.  This is probably functionality that exists in pulp-admin but hasn't been added to script.<br>
#</p>
<p dir="ltr"># ## search items ##<br>
# Metadata is used for fields search; eg: --fields="foo,bar"<br>
# Metadata: Arch Buildhost Checksum Checksumtype Description Epoch Filename License Name Provides Release Requires Vendor Version <br>
# Greppable aspects from '-d' switch:<br>
# Created, Id, Repo Id, Unit Id, Unit Type Id, Updated <br></p>
<p dir="ltr"># Ensure user is logged in, if not, attempt, if fail, bail 22.<br>
function ensure_login {<br>
  if pulp-admin tasks list > /dev/null; then<br>
    LOGGEDIN="true"<br>
  else<br>
    echo "You need to be logged in to Pulp first; enter your full AD username (eg: <a href="mailto:jimbob_mgr@AD.COLLEGE.EDU">jimbob_mgr@AD.COLLEGE.EDU</a>) :"<br>
      read username<br>
      pulp-admin login -u $username<br>
      if ! pulp-admin tasks list > /dev/null; then<br>
        echo "login not successful"<br>
        LOGGEDIN="false"<br>
        exit 22<br>
      fi<br>
  fi<br>
}</p>
<p dir="ltr">ensure_login</p>
<p dir="ltr"># This has to be done because we get JSON errors if we try to do in-line escapes, vars, etc.  Problem w/ pulp-admin input validation I belive.<br>
PREAMBLE="--filter '{\"name\":{\"\$regex\":\""<br>
SEARCHSTR="$1"<br>
EPILOGUE="\",\"\$options\":\"i\"}}'"<br>
FILTER="$PREAMBLE$SEARCHSTR$EPILOGUE"</p>
<p dir="ltr">for repos in $(pulp-admin rpm repo list | grep Id | awk '{print $2}');do <br>
  SEARCHCMD="pulp-admin rpm repo content rpm --repo-id=$repos $FILTER -d"<br>
  #Running the search on each repo using input from $1 only works when we echo the command into bash...<br>
  echo "$SEARCHCMD" | /bin/bash | egrep 'Repo Id:|Filename:' | sort -r | uniq<br>
done</p>
<div class="gmail_quote">On Jul 7, 2016 11:01 AM, "Lutchy Horace (Mailing List)" <<a href="mailto:mailinglist.subscriptions@lhprojects.net">mailinglist.subscriptions@lhprojects.net</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
I am having trouble finding any documentation on how to properly use the<br>
various command arguments, ie --str-eq, --match, etc. I am trying to run<br>
a query for a package, that after several syncs, doesn't seem to appear.<br>
<br>
For example:<br>
<br>
pulp-admin rpm repo content rpm --repo-id=centos7-x86_64-updates<br>
--match="id=device-mapper".<br>
<br>
Here is a snippet of my mongodb logs:<br>
<br>
2016-07-07T16:01:55.361+0000 [conn663] warning: log line attempted<br>
(78k) over max size (10k), printing beginning and end ... query<br>
pulp_database.units_rpm query: { $query: { _id: { $in:<br>
[ "eb82791c-fb37-4ae3-827 7-d472fec0a466",<br>
"6a6b3390-68df-4be5-8883-dd6ea17c2144",<br>
"54a27a18-3644-4992-8f77-16571337db5b",<br>
"a0897f8f-adca-42cc-a4c1-5a7125196a72",<br>
"992c7246-93fa-47fc-9eaa-52d76e4ccde4",<br>
"00611cab-dd43-4359-8aae-86ef58299 b6f",<br>
"f452eca5-870d-48b8-91e5-787b718b5a11",<br>
"f65a20d0-5ed5-473e-8786-fd4405838666",<br>
"ea23de3b-f834-4da1-9837-50ec3e4969bf",<br>
"2a757f63-eb67-4164-b304-c24f73ad4ca0", <snip>.<br>
<br>
Am I wrong to believe that packages are not stored with their names? If<br>
that's the case, how would one translate<br>
6a6b3390-68df-4be5-8883-dd6ea17c2144 to a package name? Is this a bug<br>
that needs to be reported?<br>
<br>
Regards<br>
<br>
--<br>
Lutchy Horace<br>
Owner/Operator/Administrator [<a href="http://www.lhprojects.net" rel="noreferrer" target="_blank">http://www.lhprojects.net</a>]<br>
Owner/Operator/Administrator [<a href="http://www.bombshellz.net" rel="noreferrer" target="_blank">http://www.bombshellz.net</a>]<br>
Owner/Operator/Administrator [<a href="http://www.animehouse.club" rel="noreferrer" target="_blank">http://www.animehouse.club</a>]<br>
About Me [<a href="http://about.me/lhprojects" rel="noreferrer" target="_blank">http://about.me/lhprojects</a>]<br>
USA<br>
<br>
_______________________________________________<br>
Pulp-list mailing list<br>
<a href="mailto:Pulp-list@redhat.com">Pulp-list@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/pulp-list" rel="noreferrer" target="_blank">https://www.redhat.com/mailman/listinfo/pulp-list</a><br>
</blockquote></div>