[Pulp-list] automatize repo create from cli

Michael Hrivnak mhrivnak at redhat.com
Wed Mar 13 14:29:04 UTC 2013


The "search" command won't show you the feed. The "feed" is part of the configuration for a repo's importer, which is a separate object in the database. The "pulp-admin repo list --details" command joins repo objects with their importer and distributor configs for convenience, but there is no good way to do this with the "search" command.

The following would meet your needs if it is not a requirement to search on repo ID. There is a good chance of this, since it's unusual to have multiple repositories with the same feed.

$ pulp-admin rpm repo list --details| grep 'http://foo/bar'

If you need to match repo ID also, you can do something more exciting like this one-liner that concatenates each repo listing into one line of text before piping it through grep:

$ pulp-admin rpm repo list --details| awk '{ if (length($0) == 0) { print $0 } else { printf "%s ", $0 }}'| grep 'http://foo/bar'| grep 'Id: *repo-id'

Good luck,
Michael


----- Original Message -----
From: "Juanjo Presa" <juanjop at gmail.com>
To: pulp-list at redhat.com
Sent: Wednesday, March 13, 2013 8:27:55 AM
Subject: [Pulp-list] automatize repo create from cli


Hi, I'm trying to automatize the creation and updating of pulp repos with puppet/scripting but i've found a problem. 

I need to execute series of commands to determine if the repo exists or not yet . i.e: 

pulp-admin repo list | grep $repo-id 

... but, how can I know, for example, if the feed its correct or i need to update it. Somethin like this may be ok: 

pulp-admin repo search --str-eq='feed= http://foo/bar ' | grep $repo-id 

if the exit is 0 the feed is correct, if the exit is 1 i need to launch pulp-admin rpm repo update.... 


But this command not exists. 


Maybe the correct way to obtain this is trought the API but for a in-home creation of a puppet custom definition is easiest this way. 


Any advice? 


Thanks and apologize for my english. 

_______________________________________________
Pulp-list mailing list
Pulp-list at redhat.com
https://www.redhat.com/mailman/listinfo/pulp-list




More information about the Pulp-list mailing list