https://github.com/release-engineering/pubtools-content-gateway
https://github.com/release-engineering/pubtools-content-gateway
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/release-engineering/pubtools-content-gateway
- Owner: release-engineering
- License: gpl-3.0
- Created: 2022-04-07T06:27:14.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2024-10-29T08:38:42.000Z (over 1 year ago)
- Last Synced: 2024-10-29T09:54:30.347Z (over 1 year ago)
- Language: Python
- Size: 2.99 MB
- Stars: 1
- Watchers: 3
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: docs/README.rst
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
===============
Overview
===============
Set of scripts used for operating with the Content Gateway (CGW) service
Details
============
content-gateway is a library used for performing various content workflows related work. The library is utilized by Red Hat's internal tooling or release engineers for pushing and managing the contents of products, versions and files on the content gateway server.
The internal service which utilizes this library is called `rcm-pub`.
--------------------------------
Requirements
============
- Python 3.9+
--------------------------------
Setup
=====
::
$ pip install -r requirements.txt
$ pip install .
or
$ python setup.py install
-----------------------------
Steps to use
============
1) Setup
2) Create a YAML file with required entries for Products, Versions or Files (See :doc:`entrypoints_reference` for more details)
3) Use *push-cgw-metadata* entrypoint to do the push operation
3a) CGW password must be provided as an argument or set as the 'CGW_PASSWORD' environment variable.
Example
--------------
Example YAML file
....................
In this example we are creating one product.
We have created this `cgw_example.yaml` file with the following content
.. code-block::
- type: product # MANDATORY
state: create # MANDATORY
metadata:
name: "Test Product" # MANDATORY
productCode: "TestProduct" # MANDATORY
homepage: "https://test.com/" # OPTIONAL
downloadpage: "https://test.com/" # OPTIONAL
thankYouPage: "https://test.com/" # OPTIONAL
eloquaCode: "NOT_SET" # OPTIONAL
featuredArtifactType: "Server" # OPTIONAL
thankYouTimeout: 5
Use of entrypoint
....................
``push-cgw-metadata`` (:doc:`entrypoints_reference`) entrypoint needs to be invoked to do the pushes.
The below is an example of its invocation
.. code-block::
push-cgw-metadata -host https://content-gateway/example.com \
-p XXXXX \
-u username \
-f full_path_to_yaml_file/cgw_example.yaml
2022-09-21 12:29:01,508 [INFO ] Data validation successful for product: TestProduct
2022-09-21 12:29:01,508 [DEBUG ] Fetching for product_id of product_name:- Test Product and product_code:- TestProduct
2022-09-21 12:29:01,515 [DEBUG ] Starting new HTTPS connection (1): content-gateway/example.com:443
2022-09-21 12:29:03,183 [DEBUG ] https://content-gateway/example.com:443 "GET /content-gateway/rest/admin/products HTTP/1.1" 200 None
2022-09-21 12:29:03,808 [DEBUG ] https://content-gateway/example.com:443 "PUT /content-gateway/rest/admin/products/ HTTP/1.1" 201 7
2022-09-21 12:29:03,808 [INFO ] Created a new product with product_id:- 4009801
2022-09-21 12:29:03,808 [DEBUG ] Updating the invisible attribute of the created records
2022-09-21 12:29:03,808 [DEBUG ] Enabling the created records if required
2022-09-21 12:29:03,808 [INFO ]
All CGW operations are successfully completed...!
We can see in the logs that the product is created with some ID.