Katello neesds the ability to associate a given manifest with the distributor (consumer). The following information needs to be accessible.
public class UpstreamConsumer extends AbstractHibernateObject {
private String id;
private String uuid;
private String name;
private Owner owner;
private ConsumerType type;
private IdentityCertificate idCert;
}
The above information needs to be stored somewhere. The existing cp_consumer
table is for consumers registered to Candlepin that can be enititled. While it
contains much of the information we need to store, storing this information in
that table would cause confusion. A new table is proposed to store the above
information: cp_upstream_consumer
. The cp_owner
upstream_uuid will be
removed in favor of using a mapping table to allow a many-to-many relationship
between owner and upstream consumers.
NEW
column | type | size | nulls? | default | parents |
---|---|---|---|---|---|
id | varchar | 32 | |||
uuid | varchar | 255 | |||
name | varchar | 255 | |||
created | timestamp | 35,6 | Y | null | |
updated | timestamp | 35,6 | Y | null | |
owner_id | varchar | 32 | |||
type_id | varchar | 32 | |||
consumer_idcert_id | varchar | 32 | Y | null | cp_id_cert |
keypair_id | varchar | 32 | Y | null | cp_key_pair |
prefix_url_web | varchar | 255 | Y | null | |
prefix_url_api | varchar | 255 | Y | null |
MODIFIED
column | type | size | nulls? | default | parents |
---|---|---|---|---|---|
upstream_uuid | varchar | 255 | Y | null | cp_upstream_consumer |
A new API will be created to access the information about the upstream consumer.
Verb | GET |
Path | /candlepin/owners/$owner/upstream_consumer |
Return | List of UpstreamConsumers as JSON |
We will add an upstream_consumer
directory to the consumer_export.zip
containing the upstream_consumer in JSON format as well as its identity
certificate. The json file will be named using the consumer’s uuid with the
.json
extension. The identity certificate will be named with the identity
certificates id and the .pem
extension.
export
└── upstream_consumer
├── 6e6b0328-ab72-42b6-8963-19d8d5b2ebdb.json # upstream consumer json
└── 3009001513844743756.pem # identity certificate
Processing of the upstream_consumer
directory will be added to the existing
import process. At this time we will create a new record in the
cp_upstream_consumer
to hold the information contained in the
upstream_consumer_uuid.json file. We will maintain the same information
EXCEPT the database id which will be regenerated by the server upon storing the
record. The upstream_uuid on cp_owner will then point to the record in
cp_upstream_consumer.
The existing cp_owner
table has a upstream_uuid (VARCHAR(255)) column. We need to migrate that to be an upstream_id (VARCHAR(32)) foreign key to the new cp_upstream_consumer
table.
A couple of ways to get the upstream consumer created:
DO WE NEED A HISTORICAL RECORD IN IMPORT_RECORD of the upstream consumer? i.e. web url, etc.