Managing Python type content
You can use orcharhino to manage Python type repositories. To achieve this, products in orcharhino include repositories for Python type content. This provides a generic method to incorporate Python packages in a product.
You can upload Python packages to Python type repositories and synchronize files from an upstream orcharhino Server.
When you add Python packages to a Python type repository, you can use the normal orcharhino management functions such as adding a specific version to a content view to provide version control and making the repository available on various orcharhino Proxy Servers.
You must download the files on clients over HTTP or HTTPS using curl -O
.
You can create an independent repository source in a directory on orcharhino Server, or on a remote HTTP server, and then synchronize the contents of that directory into orcharhino. This method is useful when you have multiple Python packages to add to a repository.
Synchronizing Python repositories
On orcharhino, you can synchronize your Python repositories from any mirror and other orcharhino instances. You can view the Python packages in the orcharhino management UI at Content > Content Types > Other Content Types.
-
In the orcharhino management UI, navigate to Content > Products.
-
Select a product by name.
-
In the Products window, select the name of a product that you want to create a repository for.
-
Click the Repositories tab, and then click New Repository.
-
In the Name field, enter a name for the repository.
The Label field is populated automatically based on the name.
-
From the Type list, select python.
-
In the Upstream URL field, enter the URL for the upstream content source, for example,
https://pypi.org
. -
Optional: Clear Verify SSL if you do not want orcharhino Server to verify the SSL certificate of the upstream content source.
-
Optional: In the Upstream Username field, enter the user name for the upstream repository if required for authentication. Clear this field if the repository does not require authentication.
-
Optional: In the Upstream Password field, enter the corresponding password for the upstream repository. Clear this field if the repository does not require authentication.
-
Optional: In the Excludes field, enter a list of Python packages separated by newlines to exclude from synchronizing to orcharhino.
-
Optional: In the Includes field, enter a list of Python packages separated by newlines to limit the synchronization only to the included packages.
-
Optional: In the Package Types field, enter a list of package types separated by comma. You can enter
sdist
to synchronize the source distribution orbdist_wheel
to synchronize the built distribution. -
From the Mirroring Policy list, select the type of content synchronization orcharhino Server performs. For more information, see Mirroring Policies Overview.
-
Optional: In the HTTP Proxy Policy field, select an HTTP proxy.
-
Optional: You can clear the Unprotected checkbox to require a subscription entitlement certificate for accessing this repository. By default, the repository is published through HTTP.
-
Optional: In the SSL CA Cert field, select the SSL CA Certificate for the repository.
-
Optional: In the SSL Client cert field, select the SSL Client Certificate for the repository.
-
Optional: In the SSL Client Key field, select the SSL Client Key for the repository.
-
Click Save to create the repository.
-
Select your repository.
-
From the Select Action menu, select Sync Now.
Uploading files to a Python type repository
You can upload files from your local machine to a Python type repository.
-
In the orcharhino management UI, navigate to Content > Products.
-
Select a product by name.
-
Select a Python type repository by name.
-
Click Browse to search and select the file you want to upload.
You can upload
.whl
packages and.tar.gz
archives that contain Python packages. -
Click Upload to upload the selected file to orcharhino Server.
# hammer repository upload-content \ --id My_Repository_ID \ --organization-id My_Organization_ID \ --path Path_To_My_File
The --path
option can indicate a file, a directory of files, or a glob expression of files.
Globs must be escaped by single or double quotes.
-
Visit the Published At URL to see the file.
Installing Python packages from orcharhino Server
You can install Python packages from orcharhino on hosts using pip
.
-
You have uploaded or synchronized a Python package to orcharhino.
-
On your hosts, set the URL to orcharhino Server to install a Python package:
$ pip install \ --index-url https://orcharhino.example.com/pulp/content/My_Organization_Label/Library/custom/My_Product/My_Python_Repository/simple/ \ My_Python_Package
If your host does not trust the certificate of your orcharhino Server, add the
--trusted-host orcharhino.example.com
option.
Downloading files to a host from a Python type repository
You can download files to a client over HTTPS using curl -O
, and optionally over HTTP if the Unprotected option for repositories is selected.
-
You have a Python type repository.
-
You know the name of the Python package you want to download to clients from the Python type repository.
-
To download the Python packages over HTTPS to your hosts, you require:
-
The
katello-server-ca.crt
. For more information, see Importing the Katello Root CA Certificate in Administering orcharhino. -
An Organization Debug Certificate. For more information, see Creating an Organization Debug Certificate in Managing Organizations and Locations.
-
-
In the orcharhino management UI, navigate to Content > Products.
-
Select a product by name.
-
Select a Python type repository by name.
-
Optional: Select the Unprotected checkbox to access the repository published through HTTP.
-
Copy the Published At URL.
-
On your client, download the file from orcharhino Server:
-
For HTTPS:
# curl \ --cacert ./_katello-server-ca.crt \ --cert ./_My_Organization_key-cert.pem \ --remote-name \ https://orcharhino.example.com/pulp/content/My_Organization_Label/Library/custom/My_Product_Label/My_Repository_Label/My_File
-
For HTTP:
# curl \ --remote-name \ http://orcharhino.example.com/pulp/content/My_Organization_Label/Library/custom/My_Product_Label/My_Repository_Label/My_File
-
-
List all
file
type repositories:# hammer repository list --content-type python
-
View the repository information:
# hammer repository info \ --name "My_Python_Repository" \ --organization-id My_Organization_ID \ --product "My_Product"
-
On your client, download the file from orcharhino Server:
-
For HTTPS:
# curl \ --cacert ./_katello-server-ca.crt \ --cert ./_My_Organization_key-cert.pem \ --remote-name \ https://orcharhino.example.com/pulp/content/My_Organization_Label/Library/custom/My_Product_Label/My_Repository_Label/My_File
-
For HTTP:
# curl \ --remote-name \ http://orcharhino.example.com/pulp/content/My_Organization_Label/Library/custom/My_Product_Label/My_Repository_Label/My_File
-
The text and illustrations on this page are licensed by ATIX AG under a Creative Commons Attribution Share Alike 4.0 International ("CC BY-SA 4.0") license. This page also contains text from the official Foreman documentation which uses the same license ("CC BY-SA 4.0"). |