Difference between revisions of "Python-freezerclient"
Memo Garcia (talk | contribs) (Created page with "Python Freezer Client") |
Memo Garcia (talk | contribs) |
||
Line 1: | Line 1: | ||
− | Python | + | == Overview == |
+ | |||
+ | This is a client for OpenStack Freezer API, in it there are 2 major components: | ||
+ | * freezerclient: python bindings for freezer API | ||
+ | * freezer: command-line interface for freezer API | ||
+ | |||
+ | == Installation == | ||
+ | |||
+ | Installing python-freezerclient can be install it from: | ||
+ | |||
+ | # from pypi | ||
+ | pip install python-freezerclient | ||
+ | # or from source | ||
+ | git clone https://github.com/openstack/python-freezerclient | ||
+ | cd python-freezerclient | ||
+ | pip install -e . | ||
+ | |||
+ | == Usage == | ||
+ | |||
+ | |||
+ | === CLI === | ||
+ | |||
+ | Installing this package gets you a shell command, ``freezer``, that you can use to interact with all the freezer compoenents like the API, Scheduler and Agent. | ||
+ | |||
+ | You'll need to provide your OpenStack username and password. You can do this with the --os-username, --os-password and --os-tenant-name params, but it's easier to just set them as environment variables: | ||
+ | |||
+ | |||
+ | # for keystone v2.0 | ||
+ | export OS_USERNAME=username | ||
+ | export OS_PASSWORD=password | ||
+ | export OS_TENANT_NAME=tenant | ||
+ | export OS_BACKUP_URL=http://127.0.0.1:9090 | ||
+ | export OS_IDENTITY_API_VERSION=2 | ||
+ | export OS_AUTH_URL=http://127.0.0.1:5000/v2.0 | ||
+ | |||
+ | # for keystone v3 | ||
+ | export OS_USERNAME=username | ||
+ | export OS_PASSWORD=password | ||
+ | export OS_BACKUP_URL=http://127.0.0.1:9090 | ||
+ | export OS_IDENTITY_API_VERSION=3 | ||
+ | export OS_AUTH_URL=http://127.0.0.1:5000/v3 | ||
+ | export OS_PROJECT_NAME=tenant | ||
+ | export OS_PROJECT_DOMAIN_NAME=Default | ||
+ | export OS_USER_DOMAIN_NAME=Default | ||
+ | |||
+ | and then you can start using the cli. For example to list all your jobs: | ||
+ | |||
+ | freezer job-list | ||
+ | |||
+ | To get a complete list of the commands: | ||
+ | |||
+ | freezer -h | ||
+ | |||
+ | |||
+ | === Python === | ||
+ | |||
+ | There's also a complete Python API: | ||
+ | |||
+ | from freezerclient.v1.client import Client as FreezerClient | ||
+ | client = Client(VERSION, USERNAME, PASSWORD, TENANT_NAME, AUTH_URL, ENDPOINT) | ||
+ | jobs = client.jobs.list() |
Latest revision as of 14:57, 16 March 2016
Contents
Overview
This is a client for OpenStack Freezer API, in it there are 2 major components:
- freezerclient: python bindings for freezer API
- freezer: command-line interface for freezer API
Installation
Installing python-freezerclient can be install it from:
# from pypi pip install python-freezerclient # or from source git clone https://github.com/openstack/python-freezerclient cd python-freezerclient pip install -e .
Usage
CLI
Installing this package gets you a shell command, ``freezer``, that you can use to interact with all the freezer compoenents like the API, Scheduler and Agent.
You'll need to provide your OpenStack username and password. You can do this with the --os-username, --os-password and --os-tenant-name params, but it's easier to just set them as environment variables:
# for keystone v2.0 export OS_USERNAME=username export OS_PASSWORD=password export OS_TENANT_NAME=tenant export OS_BACKUP_URL=http://127.0.0.1:9090 export OS_IDENTITY_API_VERSION=2 export OS_AUTH_URL=http://127.0.0.1:5000/v2.0
# for keystone v3 export OS_USERNAME=username export OS_PASSWORD=password export OS_BACKUP_URL=http://127.0.0.1:9090 export OS_IDENTITY_API_VERSION=3 export OS_AUTH_URL=http://127.0.0.1:5000/v3 export OS_PROJECT_NAME=tenant export OS_PROJECT_DOMAIN_NAME=Default export OS_USER_DOMAIN_NAME=Default
and then you can start using the cli. For example to list all your jobs:
freezer job-list
To get a complete list of the commands:
freezer -h
Python
There's also a complete Python API:
from freezerclient.v1.client import Client as FreezerClient client = Client(VERSION, USERNAME, PASSWORD, TENANT_NAME, AUTH_URL, ENDPOINT) jobs = client.jobs.list()