diff --git a/.gitignore b/.gitignore index d2b698d..21943c0 100644 --- a/.gitignore +++ b/.gitignore @@ -20,7 +20,7 @@ ChangeLog doc/source/reference/api/* doc/build/* dist -designateclient/versioninfo +tatuclient/versioninfo .testrepository *.log .idea/ \ No newline at end of file diff --git a/.gitreview b/.gitreview index 9108340..e8e0072 100644 --- a/.gitreview +++ b/.gitreview @@ -1,4 +1,4 @@ [gerrit] host=review.openstack.org port=29418 -project=openstack/python-designateclient.git +project=openstack/python-tatuclient.git diff --git a/.testr.conf b/.testr.conf index 5325b9e..b3beba0 100644 --- a/.testr.conf +++ b/.testr.conf @@ -4,7 +4,7 @@ test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \ OS_LOG_CAPTURE=${OS_LOG_CAPTURE:-1} \ OS_DEBUG=${OS_DEBUG:-1} \ OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-160} \ - ${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./designateclient/tests} $LISTOPT $IDOPTION + ${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./tatuclient/tests} $LISTOPT $IDOPTION test_id_option=--load-list $IDFILE test_list_option=--list diff --git a/.zuul.yaml b/.zuul.yaml index 0c68e7f..0ab2597 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -1,3 +1,3 @@ - project: templates: - - designate-devstack-jobs + - tatu-devstack-jobs diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index aaedfac..4241e2c 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -13,4 +13,4 @@ Pull requests submitted through GitHub will be ignored. Bugs should be filed on Launchpad, not GitHub: - https://bugs.launchpad.net/python-designateclient + https://bugs.launchpad.net/python-tatuclient diff --git a/README.rst b/README.rst index b5e9b46..b027105 100644 --- a/README.rst +++ b/README.rst @@ -2,31 +2,31 @@ Team and repository tags ======================== -.. image:: https://governance.openstack.org/tc/badges/python-designateclient.svg +.. image:: https://governance.openstack.org/tc/badges/python-tatuclient.svg :target: https://governance.openstack.org/tc/reference/tags/index.html .. Change things from this point on -Python bindings to the Designate API +Python bindings to the Tatu API ===================================== -.. image:: https://img.shields.io/pypi/v/python-designateclient.svg - :target: https://pypi.python.org/pypi/python-designateclient/ +.. image:: https://img.shields.io/pypi/v/python-tatuclient.svg + :target: https://pypi.python.org/pypi/python-tatuclient/ :alt: Latest Version -.. image:: https://img.shields.io/pypi/dm/python-designateclient.svg - :target: https://pypi.python.org/pypi/python-designateclient/ +.. image:: https://img.shields.io/pypi/dm/python-tatuclient.svg + :target: https://pypi.python.org/pypi/python-tatuclient/ :alt: Downloads -This is a client library for Designate built on the Designate API. It -provides a Python API (the ``designateclient`` module) and a command-line tool -(``designate``). +This is a client library for Tatu built on the Tatu API. It +provides a Python API (the ``tatuclient`` module) and a command-line tool +(``tatu``). Development takes place via the usual OpenStack processes as outlined in the `developer guide `_. The master -repository is in `Git `_. +repository is in `Git `_. -See release notes and more at ``_. +See release notes and more at ``_. * License: Apache License, Version 2.0 * `PyPi`_ - package installation @@ -35,8 +35,8 @@ See release notes and more at `] [--print-empty] [--noindent] [--prefix PREFIX] --service SERVICE --host @@ -188,14 +188,14 @@ Ping a service on a given host ``--host HOST`` Hostname -.. _designate_domain-create: +.. _tatu_domain-create: -designate domain-create +tatu domain-create ----------------------- .. code-block:: console - usage: designate domain-create [-h] [-f {html,json,shell,table,value,yaml}] + usage: tatu domain-create [-h] [-f {html,json,shell,table,value,yaml}] [-c COLUMN] [--max-width ] [--print-empty] [--noindent] [--prefix PREFIX] --name NAME --email EMAIL [--ttl TTL] @@ -220,14 +220,14 @@ Create Domain ``--description DESCRIPTION`` Description. -.. _designate_domain-delete: +.. _tatu_domain-delete: -designate domain-delete +tatu domain-delete ----------------------- .. code-block:: console - usage: designate domain-delete [-h] [-f {html,json,shell,table,value,yaml}] + usage: tatu domain-delete [-h] [-f {html,json,shell,table,value,yaml}] [-c COLUMN] [--max-width ] [--print-empty] [--noindent] [--prefix PREFIX] id @@ -244,14 +244,14 @@ Delete Domain ``-h, --help`` show this help message and exit -.. _designate_domain-get: +.. _tatu_domain-get: -designate domain-get +tatu domain-get -------------------- .. code-block:: console - usage: designate domain-get [-h] [-f {html,json,shell,table,value,yaml}] + usage: tatu domain-get [-h] [-f {html,json,shell,table,value,yaml}] [-c COLUMN] [--max-width ] [--print-empty] [--noindent] [--prefix PREFIX] id @@ -268,14 +268,14 @@ Get Domain ``-h, --help`` show this help message and exit -.. _designate_domain-list: +.. _tatu_domain-list: -designate domain-list +tatu domain-list --------------------- .. code-block:: console - usage: designate domain-list [-h] [-f {csv,html,json,table,value,yaml}] + usage: tatu domain-list [-h] [-f {csv,html,json,table,value,yaml}] [-c COLUMN] [--max-width ] [--print-empty] [--noindent] [--quote {all,minimal,none,nonnumeric}] @@ -287,14 +287,14 @@ List Domains ``-h, --help`` show this help message and exit -.. _designate_domain-servers-list: +.. _tatu_domain-servers-list: -designate domain-servers-list +tatu domain-servers-list ----------------------------- .. code-block:: console - usage: designate domain-servers-list [-h] + usage: tatu domain-servers-list [-h] [-f {csv,html,json,table,value,yaml}] [-c COLUMN] [--max-width ] [--print-empty] [--noindent] @@ -313,14 +313,14 @@ List Domain Servers ``-h, --help`` show this help message and exit -.. _designate_domain-update: +.. _tatu_domain-update: -designate domain-update +tatu domain-update ----------------------- .. code-block:: console - usage: designate domain-update [-h] [-f {html,json,shell,table,value,yaml}] + usage: tatu domain-update [-h] [-f {html,json,shell,table,value,yaml}] [-c COLUMN] [--max-width ] [--print-empty] [--noindent] [--prefix PREFIX] [--name NAME] [--email EMAIL] [--ttl TTL] @@ -353,14 +353,14 @@ Update Domain ``--no-description`` -.. _designate_quota-get: +.. _tatu_quota-get: -designate quota-get +tatu quota-get ------------------- .. code-block:: console - usage: designate quota-get [-h] [-f {html,json,shell,table,value,yaml}] + usage: tatu quota-get [-h] [-f {html,json,shell,table,value,yaml}] [-c COLUMN] [--max-width ] [--print-empty] [--noindent] [--prefix PREFIX] tenant_id @@ -377,14 +377,14 @@ Get Quota ``-h, --help`` show this help message and exit -.. _designate_quota-reset: +.. _tatu_quota-reset: -designate quota-reset +tatu quota-reset --------------------- .. code-block:: console - usage: designate quota-reset [-h] [-f {html,json,shell,table,value,yaml}] + usage: tatu quota-reset [-h] [-f {html,json,shell,table,value,yaml}] [-c COLUMN] [--max-width ] [--print-empty] [--noindent] [--prefix PREFIX] tenant_id @@ -401,14 +401,14 @@ Reset Quota ``-h, --help`` show this help message and exit -.. _designate_quota-update: +.. _tatu_quota-update: -designate quota-update +tatu quota-update ---------------------- .. code-block:: console - usage: designate quota-update [-h] [-f {html,json,shell,table,value,yaml}] + usage: tatu quota-update [-h] [-f {html,json,shell,table,value,yaml}] [-c COLUMN] [--max-width ] [--print-empty] [--noindent] [--prefix PREFIX] [--domains DOMAINS] @@ -445,14 +445,14 @@ Update Quota ``--api-export-size API_EXPORT_SIZE`` Allowed zone export recordsets. -.. _designate_record-create: +.. _tatu_record-create: -designate record-create +tatu record-create ----------------------- .. code-block:: console - usage: designate record-create [-h] [-f {html,json,shell,table,value,yaml}] + usage: tatu record-create [-h] [-f {html,json,shell,table,value,yaml}] [-c COLUMN] [--max-width ] [--print-empty] [--noindent] [--prefix PREFIX] --name NAME --type TYPE --data DATA [--ttl TTL] @@ -490,14 +490,14 @@ Create Record ``--description DESCRIPTION`` Description. -.. _designate_record-delete: +.. _tatu_record-delete: -designate record-delete +tatu record-delete ----------------------- .. code-block:: console - usage: designate record-delete [-h] [-f {html,json,shell,table,value,yaml}] + usage: tatu record-delete [-h] [-f {html,json,shell,table,value,yaml}] [-c COLUMN] [--max-width ] [--print-empty] [--noindent] [--prefix PREFIX] domain_id id @@ -517,14 +517,14 @@ Delete Record ``-h, --help`` show this help message and exit -.. _designate_record-get: +.. _tatu_record-get: -designate record-get +tatu record-get -------------------- .. code-block:: console - usage: designate record-get [-h] [-f {html,json,shell,table,value,yaml}] + usage: tatu record-get [-h] [-f {html,json,shell,table,value,yaml}] [-c COLUMN] [--max-width ] [--print-empty] [--noindent] [--prefix PREFIX] domain_id id @@ -544,14 +544,14 @@ Get Record ``-h, --help`` show this help message and exit -.. _designate_record-list: +.. _tatu_record-list: -designate record-list +tatu record-list --------------------- .. code-block:: console - usage: designate record-list [-h] [-f {csv,html,json,table,value,yaml}] + usage: tatu record-list [-h] [-f {csv,html,json,table,value,yaml}] [-c COLUMN] [--max-width ] [--print-empty] [--noindent] [--quote {all,minimal,none,nonnumeric}] @@ -569,14 +569,14 @@ List Records ``-h, --help`` show this help message and exit -.. _designate_record-update: +.. _tatu_record-update: -designate record-update +tatu record-update ----------------------- .. code-block:: console - usage: designate record-update [-h] [-f {html,json,shell,table,value,yaml}] + usage: tatu record-update [-h] [-f {html,json,shell,table,value,yaml}] [-c COLUMN] [--max-width ] [--print-empty] [--noindent] [--prefix PREFIX] [--name NAME] [--type TYPE] [--data DATA] @@ -624,14 +624,14 @@ Update Record ``--no-priority`` -.. _designate_report-count-all: +.. _tatu_report-count-all: -designate report-count-all +tatu report-count-all -------------------------- .. code-block:: console - usage: designate report-count-all [-h] [-f {html,json,shell,table,value,yaml}] + usage: tatu report-count-all [-h] [-f {html,json,shell,table,value,yaml}] [-c COLUMN] [--max-width ] [--print-empty] [--noindent] [--prefix PREFIX] @@ -643,14 +643,14 @@ Get count totals for all tenants, domains and records ``-h, --help`` show this help message and exit -.. _designate_report-count-domains: +.. _tatu_report-count-domains: -designate report-count-domains +tatu report-count-domains ------------------------------ .. code-block:: console - usage: designate report-count-domains [-h] + usage: tatu report-count-domains [-h] [-f {html,json,shell,table,value,yaml}] [-c COLUMN] [--max-width ] [--print-empty] [--noindent] @@ -663,14 +663,14 @@ Get counts for total domains ``-h, --help`` show this help message and exit -.. _designate_report-count-records: +.. _tatu_report-count-records: -designate report-count-records +tatu report-count-records ------------------------------ .. code-block:: console - usage: designate report-count-records [-h] + usage: tatu report-count-records [-h] [-f {html,json,shell,table,value,yaml}] [-c COLUMN] [--max-width ] [--print-empty] [--noindent] @@ -683,14 +683,14 @@ Get counts for total records ``-h, --help`` show this help message and exit -.. _designate_report-count-tenants: +.. _tatu_report-count-tenants: -designate report-count-tenants +tatu report-count-tenants ------------------------------ .. code-block:: console - usage: designate report-count-tenants [-h] + usage: tatu report-count-tenants [-h] [-f {html,json,shell,table,value,yaml}] [-c COLUMN] [--max-width ] [--print-empty] [--noindent] @@ -703,14 +703,14 @@ Get counts for total tenants ``-h, --help`` show this help message and exit -.. _designate_report-tenant-domains: +.. _tatu_report-tenant-domains: -designate report-tenant-domains +tatu report-tenant-domains ------------------------------- .. code-block:: console - usage: designate report-tenant-domains [-h] + usage: tatu report-tenant-domains [-h] [-f {csv,html,json,table,value,yaml}] [-c COLUMN] [--max-width ] [--print-empty] [--noindent] @@ -727,14 +727,14 @@ Get a list of domains for given tenant ``--report-tenant-id REPORT_TENANT_ID`` The tenant_id being reported on. -.. _designate_report-tenants-all: +.. _tatu_report-tenants-all: -designate report-tenants-all +tatu report-tenants-all ---------------------------- .. code-block:: console - usage: designate report-tenants-all [-h] [-f {csv,html,json,table,value,yaml}] + usage: tatu report-tenants-all [-h] [-f {csv,html,json,table,value,yaml}] [-c COLUMN] [--max-width ] [--print-empty] [--noindent] [--quote {all,minimal,none,nonnumeric}] @@ -746,14 +746,14 @@ Get list of tenants and domain count for each ``-h, --help`` show this help message and exit -.. _designate_server-create: +.. _tatu_server-create: -designate server-create +tatu server-create ----------------------- .. code-block:: console - usage: designate server-create [-h] [-f {html,json,shell,table,value,yaml}] + usage: tatu server-create [-h] [-f {html,json,shell,table,value,yaml}] [-c COLUMN] [--max-width ] [--print-empty] [--noindent] [--prefix PREFIX] --name NAME @@ -768,14 +768,14 @@ Create Server ``--name NAME`` Server name. -.. _designate_server-delete: +.. _tatu_server-delete: -designate server-delete +tatu server-delete ----------------------- .. code-block:: console - usage: designate server-delete [-h] [-f {html,json,shell,table,value,yaml}] + usage: tatu server-delete [-h] [-f {html,json,shell,table,value,yaml}] [-c COLUMN] [--max-width ] [--print-empty] [--noindent] [--prefix PREFIX] id @@ -792,14 +792,14 @@ Delete Server ``-h, --help`` show this help message and exit -.. _designate_server-get: +.. _tatu_server-get: -designate server-get +tatu server-get -------------------- .. code-block:: console - usage: designate server-get [-h] [-f {html,json,shell,table,value,yaml}] + usage: tatu server-get [-h] [-f {html,json,shell,table,value,yaml}] [-c COLUMN] [--max-width ] [--print-empty] [--noindent] [--prefix PREFIX] id @@ -816,14 +816,14 @@ Get Server ``-h, --help`` show this help message and exit -.. _designate_server-list: +.. _tatu_server-list: -designate server-list +tatu server-list --------------------- .. code-block:: console - usage: designate server-list [-h] [-f {csv,html,json,table,value,yaml}] + usage: tatu server-list [-h] [-f {csv,html,json,table,value,yaml}] [-c COLUMN] [--max-width ] [--print-empty] [--noindent] [--quote {all,minimal,none,nonnumeric}] @@ -835,14 +835,14 @@ List Servers ``-h, --help`` show this help message and exit -.. _designate_server-update: +.. _tatu_server-update: -designate server-update +tatu server-update ----------------------- .. code-block:: console - usage: designate server-update [-h] [-f {html,json,shell,table,value,yaml}] + usage: tatu server-update [-h] [-f {html,json,shell,table,value,yaml}] [-c COLUMN] [--max-width ] [--print-empty] [--noindent] [--prefix PREFIX] [--name NAME] @@ -863,14 +863,14 @@ Update Server ``--name NAME`` Server name. -.. _designate_sync-all: +.. _tatu_sync-all: -designate sync-all +tatu sync-all ------------------ .. code-block:: console - usage: designate sync-all [-h] [-f {html,json,shell,table,value,yaml}] + usage: tatu sync-all [-h] [-f {html,json,shell,table,value,yaml}] [-c COLUMN] [--max-width ] [--print-empty] [--noindent] [--prefix PREFIX] @@ -881,14 +881,14 @@ Sync Everything ``-h, --help`` show this help message and exit -.. _designate_sync-domain: +.. _tatu_sync-domain: -designate sync-domain +tatu sync-domain --------------------- .. code-block:: console - usage: designate sync-domain [-h] [-f {html,json,shell,table,value,yaml}] + usage: tatu sync-domain [-h] [-f {html,json,shell,table,value,yaml}] [-c COLUMN] [--max-width ] [--print-empty] [--noindent] [--prefix PREFIX] domain_id @@ -905,14 +905,14 @@ Sync a single Domain ``-h, --help`` show this help message and exit -.. _designate_sync-record: +.. _tatu_sync-record: -designate sync-record +tatu sync-record --------------------- .. code-block:: console - usage: designate sync-record [-h] [-f {html,json,shell,table,value,yaml}] + usage: tatu sync-record [-h] [-f {html,json,shell,table,value,yaml}] [-c COLUMN] [--max-width ] [--print-empty] [--noindent] [--prefix PREFIX] domain_id record_id @@ -932,14 +932,14 @@ Sync a single Record ``-h, --help`` show this help message and exit -.. _designate_touch-domain: +.. _tatu_touch-domain: -designate touch-domain +tatu touch-domain ---------------------- .. code-block:: console - usage: designate touch-domain [-h] [-f {html,json,shell,table,value,yaml}] + usage: tatu touch-domain [-h] [-f {html,json,shell,table,value,yaml}] [-c COLUMN] [--max-width ] [--print-empty] [--noindent] [--prefix PREFIX] domain_id diff --git a/doc/source/conf.py b/doc/source/conf.py index 0ac971c..cb2be7e 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -33,10 +33,10 @@ copyright = u'2012, Managed I.T. 2013-2014, Hewlett-Packard Development Company, # built documents. # # The short X.Y version. -from tatuclient.version import version_info as designateclient_version -version = designateclient_version.canonical_version_string() +from tatuclient.version import version_info as tatuclient_version +version = tatuclient_version.canonical_version_string() # The full version, including alpha/beta/rc tags. -release = designateclient_version.version_string_with_vcs() +release = tatuclient_version.version_string_with_vcs() # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. @@ -52,4 +52,4 @@ modindex_common_prefix = ['tatuclient'] # -- Options for HTML output --------------------------------------------------- # Output file base name for HTML help builder. -htmlhelp_basename = 'designateclientdoc' +htmlhelp_basename = 'tatuclientdoc' diff --git a/doc/source/contributor/contributing.rst b/doc/source/contributor/contributing.rst index 7bcd144..a353a2a 100644 --- a/doc/source/contributor/contributing.rst +++ b/doc/source/contributor/contributing.rst @@ -1,12 +1,12 @@ Contributing ============ -Code is hosted `on GitHub`_. Submit bugs to the Designate Client project on -`Launchpad`_. Submit code to the openstack/python-designateclient project using +Code is hosted `on GitHub`_. Submit bugs to the Tatu Client project on +`Launchpad`_. Submit code to the openstack/python-tatuclient project using `Gerrit`_. -.. _on GitHub: https://github.com/openstack/python-designateclient -.. _Launchpad: https://launchpad.net/python-designateclient +.. _on GitHub: https://github.com/openstack/python-tatuclient +.. _Launchpad: https://launchpad.net/python-tatuclient .. _Gerrit: https://docs.openstack.org/infra/manual/developers.html#development-workflow Here's a quick summary: diff --git a/doc/source/contributor/functional-tests.rst b/doc/source/contributor/functional-tests.rst index 3726eb9..f518acb 100644 --- a/doc/source/contributor/functional-tests.rst +++ b/doc/source/contributor/functional-tests.rst @@ -3,15 +3,15 @@ Functional Tests ================ The functional tests invoke the client executable to see that it actually works -with a running Designate. WARNING: these tests will create and delete zones, -recordsets, and other resources in Designate. +with a running Tatu. WARNING: these tests will create and delete zones, +recordsets, and other resources in Tatu. Installation ------------ .. code-block:: shell-session - cd python-designateclient + cd python-tatuclient pip install python-openstackclient pip install -r requirements.txt -r test-requirements.txt pip install -e . @@ -26,16 +26,16 @@ config file for the test. export TEMPEST_CONFIG=tempest.conf -The tests will use Keystone to grab the Designate endpoint to test against. +The tests will use Keystone to grab the Tatu endpoint to test against. They need at least three users (two regular users, and one admin) for all the tests to run. .. code-block:: shell-session [identity] - uri = http://localhost:5000/v2.0 + uri = http://localhost:5000/v1.0 uri_v3 = http://localhost:5000/v3 - auth_version = v2 + auth_version = v1 region = RegionOne username = demo @@ -53,9 +53,9 @@ tests to run. admin_password = password admin_domain_name = Default - [designateclient] + [tatuclient] # the directory containing the openstack executable - directory=/root/python-designateclient/.venv/bin + directory=/root/python-tatuclient/.venv/bin Running the tests ----------------- diff --git a/doc/source/index.rst b/doc/source/index.rst index ea572e9..41e4e5d 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -1,23 +1,20 @@ ====================== -python-designateclient +python-tatuclient ====================== -python-designateclient provides python bindings and command line tools for both -Designate v1 and v2 APIs. +python-tatuclient provides python bindings and command line tools for Tatu +Tatu v1 APIs. The :ref:`Python API bindings ` are provided by the -:program:`designateclient` module. +:program:`tatuclient` module. There are two separate command line interfaces to work with the two API versions: -v2: the designate plugin for the :program:`openstack` command line tool. More information can be -found on the :ref:`designate v2 command line tool page `. +v1: the tatu plugin for the :program:`openstack` command line tool. More information can be +found on the :ref:`tatu v1 command line tool page `. -v1: the :program:`designate` command line tool. More information can be found -on the :ref:`designate v1 command line tool page `. - -You'll need credentials for an OpenStack cloud that implements the Designate +You'll need credentials for an OpenStack cloud that implements the Tatu API in order to use the client. .. toctree:: @@ -34,5 +31,3 @@ API in order to use the client. * :ref:`genindex` * :ref:`modindex` * :ref:`search` - -.. _Cloud DNS: http://www.hpcloud.com/products-services/dns diff --git a/doc/source/install/index.rst b/doc/source/install/index.rst index 618ec1a..4c30260 100644 --- a/doc/source/install/index.rst +++ b/doc/source/install/index.rst @@ -4,12 +4,12 @@ Installation Install the client from PyPI ---------------------------- -The :program:`python-designateclient` package is published on `PyPI`_ and so can be installed using the pip tool, which will manage installing all +The :program:`python-tatuclient` package is published on `PyPI`_ and so can be installed using the pip tool, which will manage installing all python dependencies: .. code-block:: shell-session - pip install python-designateclient + pip install python-tatuclient *Warning: the packages on PyPI may lag behind the git repo in functionality.* @@ -19,8 +19,8 @@ If you want the latest version, straight from github: .. code-block:: shell-session - git clone git@github.com:openstack/python-designateclient.git - cd python-designateclient + git clone git@github.com:openstack/python-tatuclient.git + cd python-tatuclient virtualenv .venv . .venv/bin/activate pip install -r requirements.txt -r test-requirements.txt @@ -34,12 +34,12 @@ step. You can find out more about `Development Mode`_ .. code-block:: shell-session - git clone git@github.com:openstack/python-designateclient.git - cd python-designateclient + git clone git@github.com:openstack/python-tatuclient.git + cd python-tatuclient virtualenv .venv . .venv/bin/activate pip install -r requirements.txt -r test-requirements.txt python setup.py develop .. _Development Mode: https://setuptools.readthedocs.io/en/latest/setuptools.html#development-mode -.. _PyPI: https://pypi.python.org/pypi/python-designateclient/ +.. _PyPI: https://pypi.python.org/pypi/python-tatuclient/ diff --git a/doc/source/reference/index.rst b/doc/source/reference/index.rst index 331be17..24daa78 100644 --- a/doc/source/reference/index.rst +++ b/doc/source/reference/index.rst @@ -1,5 +1,5 @@ ================================== - python-designateclient Reference + python-tatuclient Reference ================================== .. toctree:: diff --git a/doc/source/user/bindings.rst b/doc/source/user/bindings.rst index 8d79032..3b8f724 100644 --- a/doc/source/user/bindings.rst +++ b/doc/source/user/bindings.rst @@ -1,14 +1,14 @@ .. _bindings: -=========================== -Python Bindings - v1 and v2 -=========================== +==================== +Python Bindings - v1 +==================== -The python-designateclient package comes with python bindings for both versions -of the Designate API: v1 and v2. These can be used to interact with the Designate -API from any python program. +The python-tatuclient package comes with python bindings for version v1 of the +Tatu API. These can be used to interact with the Tatu API from any python +program. -Introduction - Bindings v2 +Introduction - Bindings v1 ========================== To view examples of usage please checkout the *doc/examples* folder, basic usage is: @@ -16,8 +16,8 @@ To view examples of usage please checkout the *doc/examples* folder, basic usage .. code-block:: python #!/usr/bin/env python - from designateclient.v2 import client - from designateclient import shell + from tatuclient.v1 import client + from tatuclient import shell from keystoneauth1.identity import generic from keystoneauth1 import session as keystone_session @@ -49,7 +49,7 @@ the bindings. #!/usr/bin/env python from __future__ import print_function - from designateclient.v1 import Client + from tatuclient.v1 import Client # Create an instance of the client, providing the necessary credentials @@ -80,7 +80,7 @@ And the output this program might produce: Authentication ============== -Designate supports either Keystone authentication, or no authentication at all. +Tatu supports either Keystone authentication, or no authentication at all. Keystone Authentication ----------------------- @@ -94,7 +94,7 @@ Sessions. For more information on keystoneauth API, see `Using Sessions`_. #!/usr/bin/env python - from designateclient.v1 import Client + from tatuclient.v1 import Client from keystoneauth1.identity import generic from keystoneauth1 import session as keystone_session @@ -118,14 +118,14 @@ Sessions. For more information on keystoneauth API, see `Using Sessions`_. Below is a sample of standard authentication with keystone, but also explicitly providing the endpoint to use: -.. note:: This is useful when a development Designate instances authenticates +.. note:: This is useful when a development Tatu instances authenticates against a production Keystone. .. code-block:: python #!/usr/bin/env python - from designateclient.v1 import Client + from tatuclient.v1 import Client from keystoneauth1.identity import generic from keystoneauth1 import session as keystone_session @@ -151,13 +151,13 @@ providing the endpoint to use: No Authentication ----------------- -Below is a sample of interaction with a non authenticated designate: +Below is a sample of interaction with a non authenticated tatu: .. code-block:: python #!/usr/bin/env python - from designateclient.v1 import Client + from tatuclient.v1 import Client # Create an instance of the client, providing the endpoint directly client = Client( @@ -192,7 +192,7 @@ Listing Domains #!/usr/bin/env python - from designateclient.v1 import Client + from tatuclient.v1 import Client # Create an instance of the client client = Client( @@ -209,7 +209,7 @@ Fetching a Domain by ID #!/usr/bin/env python - from designateclient.v1 import Client + from tatuclient.v1 import Client # Create an instance of the client client = Client( @@ -229,8 +229,8 @@ Creating a Domain #!/usr/bin/env python - from designateclient.v1 import Client - from designateclient.v1.domains import Domain + from tatuclient.v1 import Client + from tatuclient.v1.domains import Domain # Create an instance of the client client = Client( @@ -250,7 +250,7 @@ Updating a Domain #!/usr/bin/env python - from designateclient.v1 import Client + from tatuclient.v1 import Client # Create an instance of the client client = Client( @@ -275,7 +275,7 @@ Deleting a Domain #!/usr/bin/env python - from designateclient.v1 import Client + from tatuclient.v1 import Client # Create an instance of the client client = Client( @@ -317,7 +317,7 @@ Listing Records #!/usr/bin/env python - from designateclient.v1 import Client + from tatuclient.v1 import Client # Create an instance of the client client = Client( @@ -336,7 +336,7 @@ Fetching a Record by ID #!/usr/bin/env python - from designateclient.v1 import Client + from tatuclient.v1 import Client # Create an instance of the client client = Client( @@ -357,8 +357,8 @@ Creating a Record #!/usr/bin/env python - from designateclient.v1 import Client - from designateclient.v1.records import Record + from tatuclient.v1 import Client + from tatuclient.v1.records import Record # Create an instance of the client client = Client( @@ -380,7 +380,7 @@ Updating a Record #!/usr/bin/env python - from designateclient.v1 import Client + from tatuclient.v1 import Client # Create an instance of the client client = Client( @@ -406,7 +406,7 @@ Deleting a Record #!/usr/bin/env python - from designateclient.v1 import Client + from tatuclient.v1 import Client # Create an instance of the client client = Client( @@ -443,7 +443,7 @@ Listing Servers #!/usr/bin/env python - from designateclient.v1 import Client + from tatuclient.v1 import Client # Create an instance of the client client = Client( @@ -460,7 +460,7 @@ Fetching a Server by ID #!/usr/bin/env python - from designateclient.v1 import Client + from tatuclient.v1 import Client # Create an instance of the client client = Client( @@ -480,8 +480,8 @@ Creating a Server #!/usr/bin/env python - from designateclient.v1 import Client - from designateclient.v1.servers import Server + from tatuclient.v1 import Client + from tatuclient.v1.servers import Server # Create an instance of the client client = Client( @@ -501,7 +501,7 @@ Updating a Server #!/usr/bin/env python - from designateclient.v1 import Client + from tatuclient.v1 import Client # Create an instance of the client client = Client( @@ -526,7 +526,7 @@ Deleting a Server #!/usr/bin/env python - from designateclient.v1 import Client + from tatuclient.v1 import Client # Create an instance of the client client = Client( diff --git a/doc/source/user/index.rst b/doc/source/user/index.rst index 2602651..9aefa6e 100644 --- a/doc/source/user/index.rst +++ b/doc/source/user/index.rst @@ -1,10 +1,10 @@ ============================== - Using python-designateclient + Using python-tatuclient ============================== .. toctree:: bindings - shell-v2 + shell-v1 shell shell-examples diff --git a/doc/source/user/shell-examples.rst b/doc/source/user/shell-examples.rst index 3213fb1..8b2960d 100644 --- a/doc/source/user/shell-examples.rst +++ b/doc/source/user/shell-examples.rst @@ -1,16 +1,16 @@ ==================================== -Designate Command Line Tool Examples +Tatu Command Line Tool Examples ==================================== .. warning:: This page refers to command that use the V1 API, which is currently disabled, and will be removed in a future release Using the client against your dev environment --------------------------------------------- -Typically the designate client talks to Keystone (or a Keystone like service) via the OS_AUTH_URL setting & retrives the designate endpoint from the returned service catalog. Using ``--os-endpoint`` or ``OS_ENDPOINT`` you can specify the end point directly, this is useful if you want to point the client at a test environment that's running without a full Keystone service. +Typically the tatu client talks to Keystone (or a Keystone like service) via the OS_AUTH_URL setting & retrives the tatu endpoint from the returned service catalog. Using ``--os-endpoint`` or ``OS_ENDPOINT`` you can specify the end point directly, this is useful if you want to point the client at a test environment that's running without a full Keystone service. .. code-block:: shell-session - $ designate --os-endpoint http://127.0.0.1:9001/v1 server-create --name ns.example.com. + $ tatu --os-endpoint http://127.0.0.1:9001/v1 server-create --name ns.example.com. +------------+--------------------------------------+ | Field | Value | +------------+--------------------------------------+ @@ -20,7 +20,7 @@ Typically the designate client talks to Keystone (or a Keystone like service) vi | name | ns.example.com. | +------------+--------------------------------------+ - $ designate --os-endpoint http://127.0.0.1:9001/v1 domain-create --name example.net. --email me@example.org + $ tatu --os-endpoint http://127.0.0.1:9001/v1 domain-create --name example.net. --email me@example.org +-------------+--------------------------------------+ | Field | Value | +-------------+--------------------------------------+ @@ -34,7 +34,7 @@ Typically the designate client talks to Keystone (or a Keystone like service) vi | name | example.net. | +-------------+--------------------------------------+ - $ designate --os-endpoint http://127.0.0.1:9001/v1 record-create --name myhost.example.net. --type A --data 1.2.3.4 f98c3d91-f514-4956-a955-20eefb413a64 (domain_id) + $ tatu --os-endpoint http://127.0.0.1:9001/v1 record-create --name myhost.example.net. --type A --data 1.2.3.4 f98c3d91-f514-4956-a955-20eefb413a64 (domain_id) +-------------+--------------------------------------+ | Field | Value | +-------------+--------------------------------------+ @@ -50,14 +50,14 @@ Typically the designate client talks to Keystone (or a Keystone like service) vi | name | myhost.example.net. | +-------------+--------------------------------------+ - $ designate domain-list + $ tatu domain-list +--------------------------------------+--------------+------------+ | id | name | serial | +--------------------------------------+--------------+------------+ | 88c14ecf-b034-424c-b081-ca42494dcdf9 | example.com. | 1462372104 | +--------------------------------------+--------------+------------+ - $ designate domain-update --email example@example.com 88c14ecf-b034-424c-b081-ca42494dcdf9 (domain_id) + $ tatu domain-update --email example@example.com 88c14ecf-b034-424c-b081-ca42494dcdf9 (domain_id) +-------------+---------------------------------------+ | Field | Value | +-------------+---------------------------------------+ @@ -71,9 +71,9 @@ Typically the designate client talks to Keystone (or a Keystone like service) vi | name | example.com. | +-------------+---------------------------------------+ - $ designate domain-delete 88c14ecf-b034-424c-b081-ca42494dcdf9 (domain_id) + $ tatu domain-delete 88c14ecf-b034-424c-b081-ca42494dcdf9 (domain_id) - $ designate record-list 66584cdd-f7a6-4f0e-acf0-3dd5ad04830d (domain_id) + $ tatu record-list 66584cdd-f7a6-4f0e-acf0-3dd5ad04830d (domain_id) +--------------------------------------+------+-----------------------+-----------------------------------------------------------------+ | id | type | name | data | +--------------------------------------+------+-----------------------+-----------------------------------------------------------------+ @@ -83,7 +83,7 @@ Typically the designate client talks to Keystone (or a Keystone like service) vi | 7e80531d-bd65-49bc-a316-a6a06cd7fe26 | A | example1.example.com. | 198.51.100.1 | +--------------------------------------+------+-----------------------+-----------------------------------------------------------------+ - $ designate record-update --name example1.example.com. --type A --data 198.5.100.2 --ttl 3600 66584cdd-f7a6-4f0e-acf0-3dd5ad04830d (domain-id) 7e80531d-bd65-49bc-a316-a6a06cd7fe26 (record_id) + $ tatu record-update --name example1.example.com. --type A --data 198.5.100.2 --ttl 3600 66584cdd-f7a6-4f0e-acf0-3dd5ad04830d (domain-id) 7e80531d-bd65-49bc-a316-a6a06cd7fe26 (record_id) +-------------+--------------------------------------+ | Field | Value | +-------------+--------------------------------------+ @@ -99,9 +99,9 @@ Typically the designate client talks to Keystone (or a Keystone like service) vi | name | example1.example.com. | +-------------+--------------------------------------+ - $ designate record-delete 66584cdd-f7a6-4f0e-acf0-3dd5ad04830d (domain-id) 7e80531d-bd65-49bc-a316-a6a06cd7fe26 (record_id) + $ tatu record-delete 66584cdd-f7a6-4f0e-acf0-3dd5ad04830d (domain-id) 7e80531d-bd65-49bc-a316-a6a06cd7fe26 (record_id) - $ designate quota-get 70a4596c9974429db5fb6fe240ab87b9 (tenant_id) + $ tatu quota-get 70a4596c9974429db5fb6fe240ab87b9 (tenant_id) +-------------------+-------+ | Field | Value | +-------------------+-------+ @@ -111,7 +111,7 @@ Typically the designate client talks to Keystone (or a Keystone like service) vi | domain_records | 500 | +-------------------+-------+ - $ designate quota-update --domains 50 --domain-recordsets 1000 --recordset-records 40 --domain-records 1000 70a4596c9974429db5fb6fe240ab87b9 (tenant_id) + $ tatu quota-update --domains 50 --domain-recordsets 1000 --recordset-records 40 --domain-records 1000 70a4596c9974429db5fb6fe240ab87b9 (tenant_id) +-------------------+-------+ | Field | Value | +-------------------+-------+ @@ -121,7 +121,7 @@ Typically the designate client talks to Keystone (or a Keystone like service) vi | domain_records | 1000 | +-------------------+-------+ - $ designate quota-get 70a4596c9974429db5fb6fe240ab87b9 (tenant_id) + $ tatu quota-get 70a4596c9974429db5fb6fe240ab87b9 (tenant_id) +-------------------+-------+ | Field | Value | +-------------------+-------+ diff --git a/doc/source/user/shell-v2.rst b/doc/source/user/shell-v2.rst index 58d5c3e..8a59e70 100644 --- a/doc/source/user/shell-v2.rst +++ b/doc/source/user/shell-v2.rst @@ -1,23 +1,23 @@ -.. _shell-v2: +.. _shell-v1: -=========================== -OpenStack CLI (v2 API only) -=========================== +============= +OpenStack CLI +============= -The python-designateclient package comes with a plugin for the openstack +The python-tatuclient package comes with a plugin for the openstack command line tool (installed as :program:`openstack`). This can be used to -access a Designate API without having to manipulate JSON by hand, it can also +access a Tatu API without having to manipulate JSON by hand, it can also produce the output in a variety of formats (JSON, CSV) and allow you to select columns to be displayed. Installation ------------ -Both *python-openstackclient* and *python-designateclient* must be installed: +Both *python-openstackclient* and *python-tatuclient* must be installed: :: - $ pip install python-openstackclient python-designateclient + $ pip install python-openstackclient python-tatuclient Configuration @@ -72,7 +72,7 @@ With enough details now in the environment, you can use the Now that the zone has been created, we can start adding records. You'll note that the zone name (example.com) has a trailing ``.``, as per -the DNS standard, and we didn't set a TTL. +the SSH standard, and we didn't set a TTL. .. code-block:: shell-session @@ -94,11 +94,11 @@ the DNS standard, and we didn't set a TTL. | zone_id | 388814ef-3c5d-415e-a866-5b1d13d78dae | +-------------+--------------------------------------+ -Designate-specific Subcommands +Tatu-specific Subcommands ------------------------------ Aside from the ``zone create`` and ``recordset create`` subcommands, this is -the full list of subcommands that enable Designate V2 support: +the full list of subcommands that enable Tatu V1 support: ============================ ====================================================== =============== subcommand Notes Admin Required @@ -149,7 +149,7 @@ tld set Set tld properties tld delete Delete tld Yes ============================ ====================================================== =============== -Built-in Designate Documentation +Built-in Tatu Documentation -------------------------------- You'll find complete documentation on the shell by running: ``openstack --help`` @@ -271,7 +271,7 @@ Delete a recordset: Working with PTR Records '''''''''''''''''''''''' -Reverse DNS for Neutron Floating IPs can be managed with the "ptr" subcommand. +Reverse SSH for Neutron Floating IPs can be managed with the "ptr" subcommand. Create a PTR record: @@ -310,7 +310,7 @@ Delete a PTR record: Working with Zone Exports ''''''''''''''''''''''''' -Zone exports enable you to save Designate zone information offline. +Zone exports enable you to save Tatu zone information offline. Create a zone export: @@ -363,7 +363,7 @@ Delete zone export: Working with Zone Imports ''''''''''''''''''''''''' -Zone imports enable you to import a zone into Designate from a file on the filesystem. +Zone imports enable you to import a zone into Tatu from a file on the filesystem. Create a zone import from a file: @@ -461,7 +461,7 @@ Create a Zone Transfer Request | id | 98ba1d22-c092-4603-891f-8a0ab04f7e57 | | key | J6JCET2C | | links | {u'self': | - | | u'http://192.168.11.182:9001/v2/zones/tasks/transfer_requests/98ba1d22-c092-4603-891f- | + | | u'http://192.168.11.182:9001/v1/zones/tasks/transfer_requests/98ba1d22-c092-4603-891f- | | | 8a0ab04f7e57'} | | project_id | 10457ad1fe074f4a89bb1e4c0cd83d40 | | status | ACTIVE | @@ -507,9 +507,9 @@ Accept a Zone Transfer Request | id | a8750f50-d7e6-403a-89d2-e209d62ef60e | | key | J6JCET2C | | links | {u'self': | - | | u'http://192.168.11.182:9001/v2/zones/tasks/transfer_accepts/a8750f50-d7e6 | + | | u'http://192.168.11.182:9001/v1/zones/tasks/transfer_accepts/a8750f50-d7e6 | | | -403a-89d2-e209d62ef60e', u'zone': | - | | u'http://192.168.11.182:9001/v2/zones/53cdcf82-9e32-4a00-a90d-32d6ec5db7e9'} | + | | u'http://192.168.11.182:9001/v1/zones/53cdcf82-9e32-4a00-a90d-32d6ec5db7e9'} | | project_id | 10457ad1fe074f4a89bb1e4c0cd83d40 | | status | COMPLETE | | updated_at | 2016-05-10 05:02:52 | diff --git a/doc/source/user/shell.rst b/doc/source/user/shell.rst index 3217ae6..db14a4d 100644 --- a/doc/source/user/shell.rst +++ b/doc/source/user/shell.rst @@ -1,19 +1,19 @@ .. _shell: ========================================================= -Designate Command Line Tool (compatible with v1 API only) +Tatu Command Line Tool (compatible with v1 API only) ========================================================= .. warning:: This page refers to command that use the V1 API, which is currently disabled, and will be removed in a future release -The python-designateclient package comes with a command line tool (installed as :program:`designate`), this can be used to access a Designate API +The python-tatuclient package comes with a command line tool (installed as :program:`tatu`), this can be used to access a Tatu API without having to manipulate JSON by hand, it can also produce the output in a variety of formats (JSON, CSV) and allow you to select columns to be displayed. Credentials ----------- -As with any OpenStack utility, :program:`designate` requires certain information to +As with any OpenStack utility, :program:`tatu` requires certain information to talk to the REST API, username, password, auth url (from where the other required endpoints are retrieved once you are authenticated). @@ -29,7 +29,7 @@ params, but it's easier to just set them as environment variables:: You will also need to define the authentication url with ``--os-auth-url`` or set is as an environment variable as well:: - export OS_AUTH_URL=https://example.com:5000/v2.0/ + export OS_AUTH_URL=https://example.com:5000/v1.0/ Since Keystone can return multiple regions in the Service Catalog, you can specify the one you want with ``--os-region-name`` (or @@ -38,11 +38,11 @@ can specify the one you want with ``--os-region-name`` (or Using the command line tool --------------------------- -With enough details now in the environment, you can use the designate client to create a domain and populate it with some records: +With enough details now in the environment, you can use the tatu client to create a domain and populate it with some records: .. code-block:: shell-session - $ designate domain-create --name example.com. --email admin@example.com + $ tatu domain-create --name example.com. --email admin@example.com +-------------+--------------------------------------+ | Field | Value | +-------------+--------------------------------------+ @@ -58,12 +58,12 @@ With enough details now in the environment, you can use the designate client to Now that the domain has been created, we can start adding records. -You'll note that the name (www.example.com) has a trailing ``.``, as per the DNS standard, we didn't set a TTL and we had to specify the parent +You'll note that the name (www.example.com) has a trailing ``.``, as per the SSH standard, we didn't set a TTL and we had to specify the parent zone/domain by domain_id ``eacbe2a5-95f1-4a9f-89f5-b9c58009b163``. .. code-block:: shell-session - $ designate record-create eacbe2a5-95f1-4a9f-89f5-b9c58009b163 --name www.example.com. --type A --data 1.2.3.4 + $ tatu record-create eacbe2a5-95f1-4a9f-89f5-b9c58009b163 --name www.example.com. --type A --data 1.2.3.4 +-------------+--------------------------------------+ | Field | Value | +-------------+--------------------------------------+ @@ -122,13 +122,13 @@ touch-domain Touch a single Domain ======================= ====================================================== =============== -Builtin designate documentation +Builtin tatu documentation ------------------------------- You'll find complete documentation on the shell by running -``designate --help``: +``tatu --help``: -usage: designate [--version] [-v] [--log-file LOG_FILE] [-q] [-h] [--debug] +usage: tatu [--version] [-v] [--log-file LOG_FILE] [-q] [-h] [--debug] [--os-username OS_USERNAME] [--os-user-id OS_USER_ID] [--os-user-domain-id OS_USER_DOMAIN_ID] [--os-user-domain-name OS_USER_DOMAIN_NAME] @@ -145,7 +145,7 @@ usage: designate [--version] [-v] [--log-file LOG_FILE] [-q] [-h] [--debug] [--os-service-type OS_SERVICE_TYPE] [--os-cacert OS_CACERT] [--insecure] [--all-tenants] [--edit-managed] -Designate Client +Tatu Client optional arguments: --version show program's version number and exit @@ -200,11 +200,11 @@ optional arguments: --os-endpoint OS_ENDPOINT Specify an endpoint to use instead of retrieving one from the service catalog (via authentication). - Defaults to env[OS_DNS_ENDPOINT]. + Defaults to env[OS_SSH_ENDPOINT]. --os-endpoint-type OS_ENDPOINT_TYPE Defaults to env[OS_ENDPOINT_TYPE]. --os-service-type OS_SERVICE_TYPE - Defaults to env[OS_DNS_SERVICE_TYPE], or 'dns'. + Defaults to env[OS_SSH_SERVICE_TYPE], or 'ssh'. --os-cacert OS_CACERT CA certificate bundle file. Defaults to env[OS_CACERT]. diff --git a/releasenotes/notes/quota-commands-7ff037bddae95771.yaml b/releasenotes/notes/quota-commands-7ff037bddae95771.yaml index d640000..d9b8a53 100644 --- a/releasenotes/notes/quota-commands-7ff037bddae95771.yaml +++ b/releasenotes/notes/quota-commands-7ff037bddae95771.yaml @@ -1,6 +1,6 @@ --- features: - - added openstack dns quota command + + - added openstack ssh quota command + list + set + reset sub commands All sub commands can be scoped to a project using --project-id diff --git a/releasenotes/source/conf.py b/releasenotes/source/conf.py index 2191f3f..2bd6d33 100644 --- a/releasenotes/source/conf.py +++ b/releasenotes/source/conf.py @@ -11,7 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Designate Release Notes documentation build configuration file, created by +# Tatu Release Notes documentation build configuration file, created by # sphinx-quickstart on Tue Nov 3 17:40:50 2015. # # This file is execfile()d with the current directory set to its @@ -61,8 +61,8 @@ source_suffix = '.rst' master_doc = 'index' # General information about the project. -project = u'Designate Client Release Notes' -copyright = u'2015, Designate Developers' +project = u'Tatu Client Release Notes' +copyright = u'2015, Tatu Developers' # Release notes are version independent. # The full version, including alpha/beta/rc tags. @@ -191,7 +191,7 @@ html_static_path = ['_static'] # html_file_suffix = None # Output file base name for HTML help builder. -htmlhelp_basename = 'DesignateClientReleaseNotesdoc' +htmlhelp_basename = 'TatuClientReleaseNotesdoc' # -- Options for LaTeX output --------------------------------------------- @@ -211,10 +211,10 @@ latex_elements = { # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - ('index', 'DesignateClientReleaseNotes.tex', - u'Designate Client Release Notes ' + ('index', 'TatuClientReleaseNotes.tex', + u'Tatu Client Release Notes ' u'Documentation', - u'Designate Developers', 'manual'), + u'Tatu Developers', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of @@ -243,8 +243,8 @@ latex_documents = [ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ - ('index', 'designateclientreleasenotes', u'Designate Client Release Notes ' - u'Documentation', [u'Designate Developers'], 1) + ('index', 'tatuclientreleasenotes', u'Tatu Client Release Notes ' + u'Documentation', [u'Tatu Developers'], 1) ] # If true, show URL addresses after external links. @@ -257,10 +257,10 @@ man_pages = [ # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - ('index', 'DesignateClientReleaseNotes', - u'Designate Client Release Notes ' + ('index', 'TatuClientReleaseNotes', + u'Tatu Client Release Notes ' u'Documentation', - u'Designate Developers', 'DesignateClientReleaseNotes', + u'Tatu Developers', 'TatuClientReleaseNotes', 'One line description of project.', 'Miscellaneous'), ] diff --git a/releasenotes/source/index.rst b/releasenotes/source/index.rst index d2973f0..887e62e 100644 --- a/releasenotes/source/index.rst +++ b/releasenotes/source/index.rst @@ -1,5 +1,5 @@ ================================ - Designate Client Release Notes + Tatu Client Release Notes ================================ .. toctree:: diff --git a/setup.cfg b/setup.cfg index 492c27d..35369a9 100644 --- a/setup.cfg +++ b/setup.cfg @@ -32,28 +32,28 @@ scripts = [entry_points] tatuclient.versions = - 2 = tatuclient.v2.client:Client + 2 = tatuclient.v1.client:Client openstack.cli.extension = ssh = tatuclient.osc.plugin -openstack.ssh.v2 = - usercert_create = tatuclient.v2.cli.usercert:CreateUserCertCommand - usercert_list = tatuclient.v2.cli.usercert:ListUserCertsCommand - usercert_show = tatuclient.v2.cli.usercert:ShowUserCertCommand - usercert_revoke = tatuclient.v2.cli.usercert:RevokeUserCertCommand - usercert_delete = tatuclient.v2.cli.usercert:DeleteUserCertCommand +openstack.ssh.v1 = + usercert_create = tatuclient.v1.cli.usercert:CreateUserCertCommand + usercert_list = tatuclient.v1.cli.usercert:ListUserCertsCommand + usercert_show = tatuclient.v1.cli.usercert:ShowUserCertCommand + usercert_revoke = tatuclient.v1.cli.usercert:RevokeUserCertCommand + usercert_delete = tatuclient.v1.cli.usercert:DeleteUserCertCommand - hostcert_create = tatuclient.v2.cli.hostcert:CreateHostCertCommand - hostcert_list = tatuclient.v2.cli.hostcert:ListHostCertsCommand - hostcert_show = tatuclient.v2.cli.hostcert:ShowHostCertCommand - hostcert_revoke = tatuclient.v2.cli.hostcert:RevokeHostCertCommand - hostcert_delete = tatuclient.v2.cli.hostcert:DeleteHostCertCommand + hostcert_create = tatuclient.v1.cli.hostcert:CreateHostCertCommand + hostcert_list = tatuclient.v1.cli.hostcert:ListHostCertsCommand + hostcert_show = tatuclient.v1.cli.hostcert:ShowHostCertCommand + hostcert_revoke = tatuclient.v1.cli.hostcert:RevokeHostCertCommand + hostcert_delete = tatuclient.v1.cli.hostcert:DeleteHostCertCommand - sshca_create = tatuclient.v2.cli.ca:CreateCACommand - sshca_list = tatuclient.v2.cli.ca:ListCAsCommand - sshca_show = tatuclient.v2.cli.ca:ShowCACommand - sshca_delete = tatuclient.v2.cli.ca:DeleteCACommand + sshca_create = tatuclient.v1.cli.ca:CreateCACommand + sshca_list = tatuclient.v1.cli.ca:ListCAsCommand + sshca_show = tatuclient.v1.cli.ca:ShowCACommand + sshca_delete = tatuclient.v1.cli.ca:DeleteCACommand [build_sphinx] builders = html,man diff --git a/tatuclient/functionaltests/base.py b/tatuclient/functionaltests/base.py index 4c6aeb7..9c54b06 100644 --- a/tatuclient/functionaltests/base.py +++ b/tatuclient/functionaltests/base.py @@ -20,11 +20,11 @@ from tatuclient.functionaltests import client from tatuclient.functionaltests import config -class BaseDesignateTest(base.ClientTestBase): +class BaseTatuTest(base.ClientTestBase): def _get_clients(self): config.read_config() - return client.DesignateCLI.as_user('default') + return client.TatuCLI.as_user('default') def ensure_tld_exists(self, tld): try: diff --git a/tatuclient/functionaltests/client.py b/tatuclient/functionaltests/client.py index 1ae5d38..2ccb0d6 100644 --- a/tatuclient/functionaltests/client.py +++ b/tatuclient/functionaltests/client.py @@ -73,7 +73,7 @@ def build_flags_string(flags): class ZoneCommands(object): - """This is a mixin that provides zone commands to DesignateCLI""" + """This is a mixin that provides zone commands to TatuCLI""" def zone_list(self, *args, **kwargs): return self.parsed_cmd('zone list', ListModel, *args, **kwargs) @@ -112,7 +112,7 @@ class ZoneCommands(object): class ZoneTransferCommands(object): - """A mixin for DesignateCLI to add zone transfer commands""" + """A mixin for TatuCLI to add zone transfer commands""" def zone_transfer_request_list(self, *args, **kwargs): cmd = 'zone transfer request list' @@ -155,7 +155,7 @@ class ZoneTransferCommands(object): class ZoneExportCommands(object): - """A mixin for DesignateCLI to add zone export commands""" + """A mixin for TatuCLI to add zone export commands""" def zone_export_list(self, *args, **kwargs): cmd = 'zone export list' @@ -180,7 +180,7 @@ class ZoneExportCommands(object): class ZoneImportCommands(object): - """A mixin for DesignateCLI to add zone import commands""" + """A mixin for TatuCLI to add zone import commands""" def zone_import_list(self, *args, **kwargs): cmd = 'zone import list' @@ -344,7 +344,7 @@ class BlacklistCommands(object): return self.parsed_cmd(cmd, FieldValueModel, *args, **kwargs) -class DesignateCLI(base.CLIClient, ZoneCommands, ZoneTransferCommands, +class TatuCLI(base.CLIClient, ZoneCommands, ZoneTransferCommands, ZoneExportCommands, ZoneImportCommands, RecordsetCommands, TLDCommands, BlacklistCommands): @@ -352,7 +352,7 @@ class DesignateCLI(base.CLIClient, ZoneCommands, ZoneTransferCommands, _CLIENTS = None def __init__(self, *args, **kwargs): - super(DesignateCLI, self).__init__(*args, **kwargs) + super(TatuCLI, self).__init__(*args, **kwargs) # grab the project id. this is used for zone transfer requests resp = FieldValueModel(self.openstack('token issue')) self.project_id = resp.project_id @@ -370,22 +370,22 @@ class DesignateCLI(base.CLIClient, ZoneCommands, ZoneTransferCommands, @classmethod def _init_clients(cls): cls._CLIENTS = { - 'default': DesignateCLI( - cli_dir=cfg.CONF.designateclient.directory, + 'default': TatuCLI( + cli_dir=cfg.CONF.tatuclient.directory, username=cfg.CONF.identity.username, password=cfg.CONF.identity.password, tenant_name=cfg.CONF.identity.tenant_name, uri=cfg.CONF.identity.uri, ), - 'alt': DesignateCLI( - cli_dir=cfg.CONF.designateclient.directory, + 'alt': TatuCLI( + cli_dir=cfg.CONF.tatuclient.directory, username=cfg.CONF.identity.alt_username, password=cfg.CONF.identity.alt_password, tenant_name=cfg.CONF.identity.alt_tenant_name, uri=cfg.CONF.identity.uri, ), - 'admin': DesignateCLI( - cli_dir=cfg.CONF.designateclient.directory, + 'admin': TatuCLI( + cli_dir=cfg.CONF.tatuclient.directory, username=cfg.CONF.identity.admin_username, password=cfg.CONF.identity.admin_password, tenant_name=cfg.CONF.identity.admin_tenant_name, @@ -415,7 +415,7 @@ class DesignateCLI(base.CLIClient, ZoneCommands, ZoneTransferCommands, return out def _openstack_noauth(self, cmd, *args, **kwargs): - exe = os.path.join(cfg.CONF.designateclient.directory, 'openstack') + exe = os.path.join(cfg.CONF.tatuclient.directory, 'openstack') options = build_option_string({ '--os-url': cfg.CONF.identity.override_endpoint, '--os-token': cfg.CONF.identity.override_token, diff --git a/tatuclient/functionaltests/config.py b/tatuclient/functionaltests/config.py index deab952..fa2d676 100644 --- a/tatuclient/functionaltests/config.py +++ b/tatuclient/functionaltests/config.py @@ -23,13 +23,13 @@ cfg.CONF.register_group(cfg.OptGroup( )) cfg.CONF.register_group(cfg.OptGroup( - name='tatuclient', title="Configuration for the Designate client" + name='tatuclient', title="Configuration for the Tatu client" )) cfg.CONF.register_opts([ - cfg.StrOpt('uri', help="The Keystone v2 endpoint"), + cfg.StrOpt('uri', help="The Keystone v1 endpoint"), cfg.StrOpt('uri_v3', help="The Keystone v3 endpoint"), - cfg.StrOpt('auth_version', default='v2'), + cfg.StrOpt('auth_version', default='v1'), cfg.StrOpt('region', default='RegionOne'), cfg.StrOpt('username'), diff --git a/tatuclient/functionaltests/v2/__init__.py b/tatuclient/functionaltests/v1/__init__.py similarity index 100% rename from tatuclient/functionaltests/v2/__init__.py rename to tatuclient/functionaltests/v1/__init__.py diff --git a/tatuclient/functionaltests/v2/fixtures.py b/tatuclient/functionaltests/v1/fixtures.py similarity index 90% rename from tatuclient/functionaltests/v2/fixtures.py rename to tatuclient/functionaltests/v1/fixtures.py index 614b9b1..de516e0 100644 --- a/tatuclient/functionaltests/v2/fixtures.py +++ b/tatuclient/functionaltests/v1/fixtures.py @@ -23,17 +23,17 @@ import fixtures from tempest.lib.exceptions import CommandFailed from testtools.runtest import MultipleExceptions -from tatuclient.functionaltests.client import DesignateCLI +from tatuclient.functionaltests.client import TatuCLI class BaseFixture(fixtures.Fixture): def __init__(self, user='default', *args, **kwargs): - """args/kwargs are forwarded to a create method on DesignateCLI""" + """args/kwargs are forwarded to a create method on TatuCLI""" super(BaseFixture, self).__init__() self.args = args self.kwargs = kwargs - self.client = DesignateCLI.as_user(user) + self.client = TatuCLI.as_user(user) def setUp(self): # Sometimes, exceptions are raised in _setUp methods on fixtures. @@ -51,7 +51,7 @@ class BaseFixture(fixtures.Fixture): class ZoneFixture(BaseFixture): - """See DesignateCLI.zone_create for __init__ args""" + """See TatuCLI.zone_create for __init__ args""" def _setUp(self): super(ZoneFixture, self)._setUp() @@ -67,13 +67,13 @@ class ZoneFixture(BaseFixture): class TransferRequestFixture(BaseFixture): - """See DesignateCLI.zone_transfer_request_create for __init__ args""" + """See TatuCLI.zone_transfer_request_create for __init__ args""" def __init__(self, zone, user='default', target_user='alt', *args, **kwargs): super(TransferRequestFixture, self).__init__(user, *args, **kwargs) self.zone = zone - self.target_client = DesignateCLI.as_user(target_user) + self.target_client = TatuCLI.as_user(target_user) # the client has a bug such that it requires --target-project-id. # when this bug is fixed, please remove this @@ -100,7 +100,7 @@ class TransferRequestFixture(BaseFixture): class ExportFixture(BaseFixture): - """See DesignateCLI.zone_export_create for __init__ args""" + """See TatuCLI.zone_export_create for __init__ args""" def __init__(self, zone, user='default', *args, **kwargs): super(ExportFixture, self).__init__(user, *args, **kwargs) @@ -125,7 +125,7 @@ class ExportFixture(BaseFixture): class ImportFixture(BaseFixture): - """See DesignateCLI.zone_import_create for __init__ args""" + """See TatuCLI.zone_import_create for __init__ args""" def __init__(self, zone_file_contents, user='default', *args, **kwargs): super(ImportFixture, self).__init__(user, *args, **kwargs) @@ -157,7 +157,7 @@ class ImportFixture(BaseFixture): class RecordsetFixture(BaseFixture): - """See DesignateCLI.recordset_create for __init__ args""" + """See TatuCLI.recordset_create for __init__ args""" def _setUp(self): super(RecordsetFixture, self)._setUp() @@ -175,7 +175,7 @@ class RecordsetFixture(BaseFixture): class TLDFixture(BaseFixture): - """See DesignateCLI.tld_create for __init__ args""" + """See TatuCLI.tld_create for __init__ args""" def __init__(self, user='admin', *args, **kwargs): super(TLDFixture, self).__init__(user=user, *args, **kwargs) @@ -194,7 +194,7 @@ class TLDFixture(BaseFixture): class TSIGKeyFixture(BaseFixture): - """See DesignateCLI.tsigkey_create for __init__ args""" + """See TatuCLI.tsigkey_create for __init__ args""" def __init__(self, user='admin', *args, **kwargs): super(TSIGKeyFixture, self).__init__(user=user, *args, **kwargs) @@ -213,7 +213,7 @@ class TSIGKeyFixture(BaseFixture): class BlacklistFixture(BaseFixture): - """See DesignateCLI.zone_blacklist_create for __init__ args""" + """See TatuCLI.zone_blacklist_create for __init__ args""" def __init__(self, user='admin', *args, **kwargs): super(BlacklistFixture, self).__init__(user=user, *args, **kwargs) diff --git a/tatuclient/functionaltests/v2/test_recordsets.py b/tatuclient/functionaltests/v1/test_ca.py similarity index 93% rename from tatuclient/functionaltests/v2/test_recordsets.py rename to tatuclient/functionaltests/v1/test_ca.py index cf33b46..e966697 100644 --- a/tatuclient/functionaltests/v2/test_recordsets.py +++ b/tatuclient/functionaltests/v1/test_ca.py @@ -15,14 +15,14 @@ limitations under the License. """ from tempest.lib.exceptions import CommandFailed -from tatuclient.functionaltests.base import BaseDesignateTest +from tatuclient.functionaltests.base import BaseTatuTest from tatuclient.functionaltests.datagen import random_a_recordset_name from tatuclient.functionaltests.datagen import random_zone_name -from tatuclient.functionaltests.v2.fixtures import RecordsetFixture -from tatuclient.functionaltests.v2.fixtures import ZoneFixture +from tatuclient.functionaltests.v1.fixtures import RecordsetFixture +from tatuclient.functionaltests.v1.fixtures import ZoneFixture -class TestRecordset(BaseDesignateTest): +class TestRecordset(BaseTatuTest): def setUp(self): super(TestRecordset, self).setUp() @@ -98,7 +98,7 @@ class TestRecordset(BaseDesignateTest): self.assertEqual(rset.ttl, 'None') -class TestRecordsetNegative(BaseDesignateTest): +class TestRecordsetNegative(BaseTatuTest): def test_invalid_option_on_recordset_create(self): cmd = 'recordset create de47d30b-41c5-4e38-b2c5-e0b908e19ec7 ' \ diff --git a/tatuclient/functionaltests/v1/test_hostcert.py b/tatuclient/functionaltests/v1/test_hostcert.py new file mode 100644 index 0000000..e966697 --- /dev/null +++ b/tatuclient/functionaltests/v1/test_hostcert.py @@ -0,0 +1,111 @@ +""" +Copyright 2015 Rackspace + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" +from tempest.lib.exceptions import CommandFailed + +from tatuclient.functionaltests.base import BaseTatuTest +from tatuclient.functionaltests.datagen import random_a_recordset_name +from tatuclient.functionaltests.datagen import random_zone_name +from tatuclient.functionaltests.v1.fixtures import RecordsetFixture +from tatuclient.functionaltests.v1.fixtures import ZoneFixture + + +class TestRecordset(BaseTatuTest): + + def setUp(self): + super(TestRecordset, self).setUp() + self.ensure_tld_exists('com') + self.zone = self.useFixture(ZoneFixture( + name=random_zone_name(), + email='test@example.com', + )).zone + + name = random_a_recordset_name(self.zone.name) + self.recordset = self.useFixture(RecordsetFixture( + zone_id=self.zone.id, + name=name, + records='1.2.3.4', + description='An a recordset', + type='A', + ttl=1234, + )).recordset + + self.assertEqual(self.recordset.name, name) + self.assertEqual(self.recordset.records, '1.2.3.4') + self.assertEqual(self.recordset.description, 'An a recordset') + self.assertEqual(self.recordset.type, 'A') + self.assertEqual(self.recordset.ttl, '1234') + + def test_recordset_list(self): + rsets = self.clients.recordset_list(self.zone.id) + self.assertGreater(len(rsets), 0) + + def test_recordset_create_and_show(self): + rset = self.clients.recordset_show(self.zone.id, self.recordset.id) + self.assertTrue(hasattr(self.recordset, 'action')) + self.assertTrue(hasattr(rset, 'action')) + self.assertEqual(self.recordset.created_at, rset.created_at) + self.assertEqual(self.recordset.description, rset.description) + self.assertEqual(self.recordset.id, rset.id) + self.assertEqual(self.recordset.name, rset.name) + self.assertEqual(self.recordset.records, rset.records) + self.assertEqual(self.recordset.status, rset.status) + self.assertEqual(self.recordset.ttl, rset.ttl) + self.assertEqual(self.recordset.type, rset.type) + self.assertEqual(self.recordset.updated_at, rset.updated_at) + self.assertEqual(self.recordset.version, rset.version) + self.assertEqual(self.recordset.zone_id, self.zone.id) + + def test_recordset_delete(self): + rset = self.clients.recordset_delete(self.zone.id, self.recordset.id) + self.assertEqual(rset.action, 'DELETE') + self.assertEqual(rset.status, 'PENDING') + + def test_recordset_set(self): + rset = self.clients.recordset_set( + self.zone.id, + self.recordset.id, + records='2.3.4.5', + ttl=2345, + description='Updated description', + ) + + self.assertEqual(rset.records, '2.3.4.5') + self.assertEqual(rset.ttl, '2345') + self.assertEqual(rset.description, 'Updated description') + + def test_recordset_set_clear_ttl_and_description(self): + rset = self.clients.recordset_set( + self.zone.id, + self.recordset.id, + no_description=True, + no_ttl=True, + ) + + self.assertEqual(rset.description, 'None') + self.assertEqual(rset.ttl, 'None') + + +class TestRecordsetNegative(BaseTatuTest): + + def test_invalid_option_on_recordset_create(self): + cmd = 'recordset create de47d30b-41c5-4e38-b2c5-e0b908e19ec7 ' \ + 'aaa.desig.com. --type A --records 1.2.3.4 ' \ + '--invalid "not valid"' + self.assertRaises(CommandFailed, self.clients.openstack, cmd) + + def test_invalid_recordset_command(self): + cmd = 'recordset hopefullynotvalid' + self.assertRaises(CommandFailed, self.clients.openstack, cmd) diff --git a/tatuclient/functionaltests/v1/test_usercert.py b/tatuclient/functionaltests/v1/test_usercert.py new file mode 100644 index 0000000..e966697 --- /dev/null +++ b/tatuclient/functionaltests/v1/test_usercert.py @@ -0,0 +1,111 @@ +""" +Copyright 2015 Rackspace + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" +from tempest.lib.exceptions import CommandFailed + +from tatuclient.functionaltests.base import BaseTatuTest +from tatuclient.functionaltests.datagen import random_a_recordset_name +from tatuclient.functionaltests.datagen import random_zone_name +from tatuclient.functionaltests.v1.fixtures import RecordsetFixture +from tatuclient.functionaltests.v1.fixtures import ZoneFixture + + +class TestRecordset(BaseTatuTest): + + def setUp(self): + super(TestRecordset, self).setUp() + self.ensure_tld_exists('com') + self.zone = self.useFixture(ZoneFixture( + name=random_zone_name(), + email='test@example.com', + )).zone + + name = random_a_recordset_name(self.zone.name) + self.recordset = self.useFixture(RecordsetFixture( + zone_id=self.zone.id, + name=name, + records='1.2.3.4', + description='An a recordset', + type='A', + ttl=1234, + )).recordset + + self.assertEqual(self.recordset.name, name) + self.assertEqual(self.recordset.records, '1.2.3.4') + self.assertEqual(self.recordset.description, 'An a recordset') + self.assertEqual(self.recordset.type, 'A') + self.assertEqual(self.recordset.ttl, '1234') + + def test_recordset_list(self): + rsets = self.clients.recordset_list(self.zone.id) + self.assertGreater(len(rsets), 0) + + def test_recordset_create_and_show(self): + rset = self.clients.recordset_show(self.zone.id, self.recordset.id) + self.assertTrue(hasattr(self.recordset, 'action')) + self.assertTrue(hasattr(rset, 'action')) + self.assertEqual(self.recordset.created_at, rset.created_at) + self.assertEqual(self.recordset.description, rset.description) + self.assertEqual(self.recordset.id, rset.id) + self.assertEqual(self.recordset.name, rset.name) + self.assertEqual(self.recordset.records, rset.records) + self.assertEqual(self.recordset.status, rset.status) + self.assertEqual(self.recordset.ttl, rset.ttl) + self.assertEqual(self.recordset.type, rset.type) + self.assertEqual(self.recordset.updated_at, rset.updated_at) + self.assertEqual(self.recordset.version, rset.version) + self.assertEqual(self.recordset.zone_id, self.zone.id) + + def test_recordset_delete(self): + rset = self.clients.recordset_delete(self.zone.id, self.recordset.id) + self.assertEqual(rset.action, 'DELETE') + self.assertEqual(rset.status, 'PENDING') + + def test_recordset_set(self): + rset = self.clients.recordset_set( + self.zone.id, + self.recordset.id, + records='2.3.4.5', + ttl=2345, + description='Updated description', + ) + + self.assertEqual(rset.records, '2.3.4.5') + self.assertEqual(rset.ttl, '2345') + self.assertEqual(rset.description, 'Updated description') + + def test_recordset_set_clear_ttl_and_description(self): + rset = self.clients.recordset_set( + self.zone.id, + self.recordset.id, + no_description=True, + no_ttl=True, + ) + + self.assertEqual(rset.description, 'None') + self.assertEqual(rset.ttl, 'None') + + +class TestRecordsetNegative(BaseTatuTest): + + def test_invalid_option_on_recordset_create(self): + cmd = 'recordset create de47d30b-41c5-4e38-b2c5-e0b908e19ec7 ' \ + 'aaa.desig.com. --type A --records 1.2.3.4 ' \ + '--invalid "not valid"' + self.assertRaises(CommandFailed, self.clients.openstack, cmd) + + def test_invalid_recordset_command(self): + cmd = 'recordset hopefullynotvalid' + self.assertRaises(CommandFailed, self.clients.openstack, cmd) diff --git a/tatuclient/functionaltests/v2/test_blacklist.py b/tatuclient/functionaltests/v2/test_blacklist.py deleted file mode 100644 index baa3ccd..0000000 --- a/tatuclient/functionaltests/v2/test_blacklist.py +++ /dev/null @@ -1,98 +0,0 @@ -""" -Copyright 2015 Rackspace - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -""" -from tempest.lib.exceptions import CommandFailed - -from tatuclient.functionaltests.base import BaseDesignateTest -from tatuclient.functionaltests.datagen import random_blacklist -from tatuclient.functionaltests.v2.fixtures import BlacklistFixture - - -class TestBlacklist(BaseDesignateTest): - - def setUp(self): - super(TestBlacklist, self).setUp() - pattern = random_blacklist() - self.blacklist = self.useFixture(BlacklistFixture( - pattern=pattern, - description='A random blacklist', - )).blacklist - - self.assertEqual(self.blacklist.pattern, pattern) - self.assertEqual(self.blacklist.description, 'A random blacklist') - - def test_zone_blacklist_list(self): - blacklists = self.clients.as_user('admin').zone_blacklist_list() - self.assertGreater(len(blacklists), 0) - - def test_zone_blacklist_create_and_show(self): - client = self.clients.as_user('admin') - blacklist = client.zone_blacklist_show(self.blacklist.id) - - self.assertEqual(self.blacklist.created_at, blacklist.created_at) - self.assertEqual(self.blacklist.description, blacklist.description) - self.assertEqual(self.blacklist.id, blacklist.id) - self.assertEqual(self.blacklist.pattern, blacklist.pattern) - self.assertEqual(self.blacklist.updated_at, blacklist.updated_at) - - def test_zone_blacklist_delete(self): - client = self.clients.as_user('admin') - client.zone_blacklist_delete(self.blacklist.id) - self.assertRaises(CommandFailed, client.zone_blacklist_show, - self.blacklist.id) - - def test_zone_blacklist_set(self): - client = self.clients.as_user('admin') - updated_pattern = random_blacklist('updatedblacklist') - blacklist = client.zone_blacklist_set( - id=self.blacklist.id, - pattern=updated_pattern, - description='An updated blacklist', - ) - - self.assertEqual(blacklist.created_at, self.blacklist.created_at) - self.assertEqual(blacklist.description, 'An updated blacklist') - self.assertEqual(blacklist.id, self.blacklist.id) - self.assertEqual(blacklist.pattern, updated_pattern) - self.assertNotEqual(blacklist.updated_at, self.blacklist.updated_at) - - def test_zone_blacklist_set_no_description(self): - client = self.clients.as_user('admin') - blacklist = client.zone_blacklist_set( - id=self.blacklist.id, - no_description=True, - ) - self.assertEqual(blacklist.description, 'None') - - def test_cannot_set_description_with_no_description_flag(self): - client = self.clients.as_user('admin') - self.assertRaises(CommandFailed, client.zone_blacklist_set, - self.blacklist.id, - pattern=random_blacklist(), - description='new description', - no_description=True) - - -class TestBlacklistNegative(BaseDesignateTest): - - def test_invalid_blacklist_command(self): - client = self.clients.as_user('admin') - cmd = 'zone blacklist notacommand' - self.assertRaises(CommandFailed, client.openstack, cmd) - - def test_blacklist_create_invalid_flag(self): - client = self.clients.as_user('admin') - cmd = 'zone blacklist create --pattern helloworld --notaflag invalid' - self.assertRaises(CommandFailed, client.openstack, cmd) diff --git a/tatuclient/functionaltests/v2/test_tlds.py b/tatuclient/functionaltests/v2/test_tlds.py deleted file mode 100644 index d463b48..0000000 --- a/tatuclient/functionaltests/v2/test_tlds.py +++ /dev/null @@ -1,82 +0,0 @@ -""" -Copyright 2015 Rackspace - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -""" -from tempest.lib.exceptions import CommandFailed - -from tatuclient.functionaltests.base import BaseDesignateTest -from tatuclient.functionaltests.datagen import random_tld -from tatuclient.functionaltests.v2.fixtures import TLDFixture - - -class TestTld(BaseDesignateTest): - - def setUp(self): - super(TestTld, self).setUp() - tld_name = random_tld() - self.tld = self.useFixture(TLDFixture( - name=tld_name, - description='A random tld', - )).tld - - self.assertEqual(self.tld.name, tld_name) - self.assertEqual(self.tld.description, 'A random tld') - - def test_tld_list(self): - tlds = self.clients.as_user('admin').tld_list() - self.assertGreater(len(tlds), 0) - - def test_tld_create_and_show(self): - tld = self.clients.as_user('admin').tld_show(self.tld.id) - self.assertEqual(tld.name, self.tld.name) - self.assertEqual(tld.created_at, self.tld.created_at) - self.assertEqual(tld.id, self.tld.id) - self.assertEqual(tld.name, self.tld.name) - self.assertEqual(tld.updated_at, self.tld.updated_at) - - def test_tld_delete(self): - client = self.clients.as_user('admin') - client.tld_delete(self.tld.id) - self.assertRaises(CommandFailed, client.tld_show, self.tld.id) - - def test_tld_set(self): - client = self.clients.as_user('admin') - updated_name = random_tld('updated') - tld = client.tld_set(self.tld.id, name=updated_name, - description='An updated tld') - self.assertEqual(tld.description, 'An updated tld') - self.assertEqual(tld.name, updated_name) - - def test_tld_set_no_description(self): - client = self.clients.as_user('admin') - tld = client.tld_set(self.tld.id, no_description=True) - self.assertEqual(tld.description, 'None') - - def test_no_set_tld_with_description_and_no_description(self): - client = self.clients.as_user('admin') - self.assertRaises(CommandFailed, client.tld_set, self.tld.id, - description='An updated tld', - no_description=True) - - -class TestTldNegative(BaseDesignateTest): - - def test_tld_invalid_commmand(self): - client = self.clients.as_user('admin') - self.assertRaises(CommandFailed, client.openstack, 'tld notacommand') - - def test_tld_create_invalid_flag(self): - client = self.clients.as_user('admin') - self.assertRaises(CommandFailed, client.openstack, - 'tld create --notanoption "junk"') diff --git a/tatuclient/functionaltests/v2/test_tsigkeys.py b/tatuclient/functionaltests/v2/test_tsigkeys.py deleted file mode 100644 index 8f58f9c..0000000 --- a/tatuclient/functionaltests/v2/test_tsigkeys.py +++ /dev/null @@ -1,90 +0,0 @@ -""" -Copyright 2017 SAP SE - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -""" -from tempest.lib.exceptions import CommandFailed - -from tatuclient.functionaltests.base import BaseDesignateTest -from tatuclient.functionaltests.datagen import random_tsigkey_name -from tatuclient.functionaltests.datagen import random_tsigkey_secret -from tatuclient.functionaltests.datagen import random_zone_name -from tatuclient.functionaltests.v2.fixtures import TSIGKeyFixture -from tatuclient.functionaltests.v2.fixtures import ZoneFixture - - -class TestTSIGKey(BaseDesignateTest): - def setUp(self): - super(TestTSIGKey, self).setUp() - self.ensure_tsigkey_exists('com') - self.zone = self.useFixture(ZoneFixture( - name=random_zone_name(), - email='test@example.com', - )).zone - tsig_name = random_tsigkey_name() - tsig_algorithm = "hmac-sha256" - tsig_secret = random_tsigkey_secret() - tsig_scope = 'ZONE' - self.tsig = self.useFixture(TSIGKeyFixture( - name=tsig_name, - algorithm=tsig_algorithm, - secret=tsig_secret, - scope=tsig_scope, - resource_id=self.zone.id - )).tsig - - self.assertEqual(self.tsig.name, tsig_name) - self.assertEqual(self.tsig.algorithm, tsig_algorithm) - self.assertEqual(self.tsig.secret, tsig_secret) - self.assertEqual(self.tsig.scope, tsig_scope) - self.assertEqual(self.tsig.resource_id, self.zone.id) - - def test_tsigkey_list(self): - tsigkeys = self.clients.as_user('admin').tsigkey_list() - self.assertGreater(len(tsigkeys), 0) - - def test_tsigkey_create_and_show(self): - tsigkey = self.clients.as_user('admin').tsigkey_show(self.tsigkey.id) - self.assertEqual(tsigkey.name, self.tsigkey.name) - self.assertEqual(tsigkey.created_at, self.tsigkey.created_at) - self.assertEqual(tsigkey.id, self.tsigkey.id) - self.assertEqual(self.tsig.algorithm, self.tsig_algorithm) - self.assertEqual(self.tsig.secret, self.tsig_secret) - self.assertEqual(self.tsig.scope, self.tsig_scope) - self.assertEqual(self.tsig.resource_id, self.zone.id) - self.assertEqual(tsigkey.updated_at, self.tsigkey.updated_at) - - def test_tsigkey_delete(self): - client = self.clients.as_user('admin') - client.tsigkey_delete(self.tsigkey.id) - self.assertRaises(CommandFailed, client.tsigkey_show, self.tsigkey.id) - - def test_tsigkey_set(self): - client = self.clients.as_user('admin') - updated_name = random_tsigkey_name('updated') - tsigkey = client.tsigkey_set(self.tsigkey.id, name=updated_name, - secret='An updated tsigsecret') - self.assertEqual(tsigkey.secret, 'An updated tsigsecret') - self.assertEqual(tsigkey.name, updated_name) - - -class TestTSIGKeyNegative(BaseDesignateTest): - def test_tsigkey_invalid_commmand(self): - client = self.clients.as_user('admin') - self.assertRaises(CommandFailed, client.openstack, - 'tsigkey notacommand') - - def test_tsigkey_create_invalid_flag(self): - client = self.clients.as_user('admin') - self.assertRaises(CommandFailed, client.openstack, - 'tsigkey create --notanoption "junk"') diff --git a/tatuclient/functionaltests/v2/test_zone.py b/tatuclient/functionaltests/v2/test_zone.py deleted file mode 100644 index cb3f3e3..0000000 --- a/tatuclient/functionaltests/v2/test_zone.py +++ /dev/null @@ -1,130 +0,0 @@ -""" -Copyright 2015 Rackspace - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -""" -from tempest.lib.exceptions import CommandFailed - -from tatuclient.functionaltests.base import BaseDesignateTest -from tatuclient.functionaltests.datagen import random_zone_name -from tatuclient.functionaltests.v2.fixtures import ZoneFixture - - -class TestZone(BaseDesignateTest): - - def setUp(self): - super(TestZone, self).setUp() - self.ensure_tld_exists('com') - self.fixture = self.useFixture(ZoneFixture( - name=random_zone_name(), - email='test@example.com', - )) - self.zone = self.fixture.zone - - def test_zone_list(self): - zones = self.clients.zone_list() - self.assertGreater(len(zones), 0) - - def test_zone_create_and_show(self): - zone = self.clients.zone_show(self.zone.id) - self.assertTrue(hasattr(zone, 'action')) - self.assertEqual(self.zone.created_at, zone.created_at) - self.assertEqual(self.zone.description, zone.description) - self.assertEqual(self.zone.email, zone.email) - self.assertEqual(self.zone.id, zone.id) - self.assertEqual(self.zone.masters, zone.masters) - self.assertEqual(self.zone.name, zone.name) - self.assertEqual(self.zone.pool_id, zone.pool_id) - self.assertEqual(self.zone.project_id, zone.project_id) - self.assertEqual(self.zone.serial, zone.serial) - self.assertTrue(hasattr(zone, 'status')) - self.assertEqual(self.zone.transferred_at, zone.transferred_at) - self.assertEqual(self.zone.ttl, zone.ttl) - self.assertEqual(self.zone.type, zone.type) - self.assertEqual(self.zone.updated_at, zone.updated_at) - self.assertEqual(self.zone.version, zone.version) - - def test_zone_delete(self): - zone = self.clients.zone_delete(self.zone.id) - self.assertEqual(zone.action, 'DELETE') - self.assertEqual(zone.status, 'PENDING') - - def test_zone_set(self): - ttl = int(self.zone.ttl) + 123 - email = 'updated{0}'.format(self.zone.email) - description = 'new description' - - zone = self.clients.zone_set(self.zone.id, ttl=ttl, email=email, - description=description) - self.assertEqual(ttl, int(zone.ttl)) - self.assertEqual(email, zone.email) - self.assertEqual(description, zone.description) - - def test_invalid_option_on_zone_create(self): - cmd = 'zone create %s --invalid "not a valid option"'.format( - random_zone_name()) - self.assertRaises(CommandFailed, self.clients.openstack, cmd) - - def test_invalid_zone_command(self): - cmd = 'zone hopefullynotacommand' - self.assertRaises(CommandFailed, self.clients.openstack, cmd) - - -class TestsPassingZoneFlags(BaseDesignateTest): - - def setUp(self): - super(TestsPassingZoneFlags, self).setUp() - self.ensure_tld_exists('com') - - def test_zone_create_primary_with_all_args(self): - zone_name = random_zone_name() - fixture = self.useFixture(ZoneFixture( - name=zone_name, - email='primary@example.com', - description='A primary zone', - ttl=2345, - type='PRIMARY', - )) - zone = fixture.zone - self.assertEqual(zone_name, zone.name) - self.assertEqual('primary@example.com', zone.email) - self.assertEqual('A primary zone', zone.description) - self.assertEqual('2345', zone.ttl) - self.assertEqual('PRIMARY', zone.type) - - def test_zone_create_secondary_with_all_args(self): - zone_name = random_zone_name() - fixture = self.useFixture(ZoneFixture( - name=zone_name, - description='A secondary zone', - type='SECONDARY', - masters='127.0.0.1', - )) - zone = fixture.zone - self.assertEqual(zone_name, zone.name) - self.assertEqual('A secondary zone', zone.description) - self.assertEqual('SECONDARY', zone.type) - self.assertEqual('127.0.0.1', zone.masters) - - def test_zone_set_secondary_masters(self): - fixture = self.useFixture(ZoneFixture( - name=random_zone_name(), - description='A secondary zone', - type='SECONDARY', - masters='127.0.0.1', - )) - zone = fixture.zone - self.assertEqual('127.0.0.1', zone.masters) - - zone = self.clients.zone_set(zone.id, masters='127.0.0.2') - self.assertEqual('127.0.0.2', zone.masters) diff --git a/tatuclient/functionaltests/v2/test_zone_export.py b/tatuclient/functionaltests/v2/test_zone_export.py deleted file mode 100644 index ff977e9..0000000 --- a/tatuclient/functionaltests/v2/test_zone_export.py +++ /dev/null @@ -1,81 +0,0 @@ -""" -Copyright 2016 Rackspace - -Author: Rahman Syed - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -""" -from tatuclient.functionaltests.base import BaseDesignateTest -from tatuclient.functionaltests.datagen import random_zone_name -from tatuclient.functionaltests.v2.fixtures import ExportFixture -from tatuclient.functionaltests.v2.fixtures import ZoneFixture - - -class TestZoneExport(BaseDesignateTest): - - def setUp(self): - super(TestZoneExport, self).setUp() - self.ensure_tld_exists('com') - fixture = self.useFixture(ZoneFixture( - name=random_zone_name(), - email='test@example.com', - )) - self.zone = fixture.zone - - def test_list_zone_exports(self): - zone_export = self.useFixture(ExportFixture( - zone=self.zone - )).zone_export - - zone_exports = self.clients.zone_export_list() - self.assertGreater(len(zone_exports), 0) - self.assertTrue(self._is_entity_in_list(zone_export, zone_exports)) - - def test_create_and_show_zone_export(self): - zone_export = self.useFixture(ExportFixture( - zone=self.zone - )).zone_export - - fetched_export = self.clients.zone_export_show(zone_export.id) - - self.assertEqual(zone_export.created_at, fetched_export.created_at) - self.assertEqual(zone_export.id, fetched_export.id) - self.assertEqual(zone_export.message, fetched_export.message) - self.assertEqual(zone_export.project_id, fetched_export.project_id) - self.assertEqual(zone_export.zone_id, fetched_export.zone_id) - - def test_delete_zone_export(self): - zone_export = self.useFixture(ExportFixture( - zone=self.zone - )).zone_export - - zone_exports = self.clients.zone_export_list() - self.assertTrue(self._is_entity_in_list(zone_export, zone_exports)) - - self.clients.zone_export_delete(zone_export.id) - - zone_exports = self.clients.zone_export_list() - self.assertFalse(self._is_entity_in_list(zone_export, zone_exports)) - - def test_show_export_file(self): - zone_export = self.useFixture(ExportFixture( - zone=self.zone - )).zone_export - - fetched_export = self.clients.zone_export_showfile(zone_export.id) - - self.assertIn('$ORIGIN', fetched_export.data) - self.assertIn('$TTL', fetched_export.data) - self.assertIn('SOA', fetched_export.data) - self.assertIn('NS', fetched_export.data) - self.assertIn(self.zone.name, fetched_export.data) diff --git a/tatuclient/functionaltests/v2/test_zone_import.py b/tatuclient/functionaltests/v2/test_zone_import.py deleted file mode 100644 index 3de818a..0000000 --- a/tatuclient/functionaltests/v2/test_zone_import.py +++ /dev/null @@ -1,65 +0,0 @@ -""" -Copyright 2016 Rackspace - -Author: Rahman Syed - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -""" -from tatuclient.functionaltests.base import BaseDesignateTest -from tatuclient.functionaltests.datagen import random_zone_file -from tatuclient.functionaltests.v2.fixtures import ImportFixture - - -class TestZoneImport(BaseDesignateTest): - - def setUp(self): - super(TestZoneImport, self).setUp() - self.ensure_tld_exists('com') - self.zone_file_contents = random_zone_file() - - def test_list_zone_imports(self): - zone_import = self.useFixture(ImportFixture( - zone_file_contents=self.zone_file_contents - )).zone_import - - zone_imports = self.clients.zone_import_list() - self.assertGreater(len(zone_imports), 0) - self.assertTrue(self._is_entity_in_list(zone_import, zone_imports)) - - def test_create_and_show_zone_import(self): - zone_import = self.useFixture(ImportFixture( - zone_file_contents=self.zone_file_contents - )).zone_import - - fetched_import = self.clients.zone_import_show(zone_import.id) - - self.assertEqual(zone_import.created_at, fetched_import.created_at) - self.assertEqual(zone_import.id, fetched_import.id) - self.assertEqual(zone_import.project_id, fetched_import.project_id) - - # check both statuses to avoid a race condition, causing test failure. - # we don't know when the import completes. - self.assertIn(fetched_import.status, ['PENDING', 'COMPLETE']) - - def test_delete_zone_import(self): - zone_import = self.useFixture(ImportFixture( - zone_file_contents=self.zone_file_contents - )).zone_import - - zone_imports = self.clients.zone_import_list() - self.assertTrue(self._is_entity_in_list(zone_import, zone_imports)) - - self.clients.zone_import_delete(zone_import.id) - - zone_imports = self.clients.zone_import_list() - self.assertFalse(self._is_entity_in_list(zone_import, zone_imports)) diff --git a/tatuclient/functionaltests/v2/test_zone_transfer.py b/tatuclient/functionaltests/v2/test_zone_transfer.py deleted file mode 100644 index de906fa..0000000 --- a/tatuclient/functionaltests/v2/test_zone_transfer.py +++ /dev/null @@ -1,118 +0,0 @@ -""" -Copyright 2015 Rackspace - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -""" -import unittest - -from tempest.lib.exceptions import CommandFailed - -from tatuclient.functionaltests.base import BaseDesignateTest -from tatuclient.functionaltests.client import DesignateCLI -from tatuclient.functionaltests.datagen import random_zone_name -from tatuclient.functionaltests.v2.fixtures import TransferRequestFixture -from tatuclient.functionaltests.v2.fixtures import ZoneFixture - - -class TestZoneTransferRequest(BaseDesignateTest): - - def setUp(self): - super(TestZoneTransferRequest, self).setUp() - self.ensure_tld_exists('com') - fixture = self.useFixture(ZoneFixture( - name=random_zone_name(), - email='test@example.com', - )) - self.zone = fixture.zone - - def test_list_zone_transfer_request(self): - self.useFixture(TransferRequestFixture(self.zone)) - xfrs = self.clients.zone_transfer_request_list() - self.assertGreater(len(xfrs), 0) - - def test_create_and_show_zone_transfer_request(self): - transfer_request = self.useFixture(TransferRequestFixture( - zone=self.zone, - user='default', - target_user='alt', - )).transfer_request - - fetched_xfr = self.clients.zone_transfer_request_show( - transfer_request.id) - - self.assertEqual(fetched_xfr.created_at, transfer_request.created_at) - self.assertEqual(fetched_xfr.description, transfer_request.description) - self.assertEqual(fetched_xfr.id, transfer_request.id) - self.assertEqual(fetched_xfr.key, transfer_request.key) - self.assertEqual(fetched_xfr.links, transfer_request.links) - self.assertEqual(fetched_xfr.target_project_id, - transfer_request.target_project_id) - self.assertEqual(fetched_xfr.updated_at, transfer_request.updated_at) - self.assertEqual(fetched_xfr.status, transfer_request.status) - self.assertEqual(fetched_xfr.zone_id, self.zone.id) - self.assertEqual(fetched_xfr.zone_name, self.zone.name) - - def test_delete_zone_transfer_request(self): - transfer_request = self.useFixture(TransferRequestFixture( - zone=self.zone, - user='default', - target_user='alt', - )).transfer_request - - self.clients.zone_transfer_request_delete(transfer_request.id) - self.assertRaises(CommandFailed, - self.clients.zone_transfer_request_show, - transfer_request.id) - - @unittest.skip("Fails because `zone transfer request set` returns nothing") - def test_set_zone_transfer_request(self): - transfer_request = self.useFixture(TransferRequestFixture( - zone=self.zone, - description="old description", - )).transfer_request - - self.assertEqual(transfer_request.description, "old description") - - updated_xfr = self.clients.zone_transfer_request_set( - transfer_request.id, - description="updated description") - self.assertEqual(updated_xfr.description, "updated description") - - -class TestZoneTransferAccept(BaseDesignateTest): - - def setUp(self): - super(TestZoneTransferAccept, self).setUp() - self.ensure_tld_exists('com') - fixture = self.useFixture(ZoneFixture( - name=random_zone_name(), - email='test@example.com', - )) - self.zone = fixture.zone - - self.target_client = DesignateCLI.as_user('alt') - fixture = self.useFixture(TransferRequestFixture( - zone=self.zone, - user='default', - target_user='alt', - target_project_id=self.target_client.project_id, - )) - self.transfer_request = fixture.transfer_request - - def test_zone_transfer_accept_request(self): - self.target_client.zone_transfer_accept_request( - id=self.transfer_request.id, - key=self.transfer_request.key, - ) - self.target_client.zone_show(self.zone.id) - self.assertRaises(CommandFailed, self.clients.zone_show, self.zone.id) diff --git a/tatuclient/osc/plugin.py b/tatuclient/osc/plugin.py index d0b19a0..1b0bf57 100644 --- a/tatuclient/osc/plugin.py +++ b/tatuclient/osc/plugin.py @@ -21,12 +21,12 @@ from osc_lib import utils as oscutils from tatuclient import shell -DEFAULT_API_VERSION = '2' +DEFAULT_API_VERSION = '1' API_NAME = 'ssh' API_VERSION_OPTION = 'os_ssh_api_version' API_VERSIONS = { - '1': 'tatuclient.v2.client.Client', + '1': 'tatuclient.v1.client.Client', } diff --git a/tatuclient/shell.py b/tatuclient/shell.py index 88b4b1b..da18d40 100644 --- a/tatuclient/shell.py +++ b/tatuclient/shell.py @@ -39,13 +39,13 @@ def env(*vars, **kwargs): return kwargs.get('default', '') -class DesignateShell(App): +class TatuShell(App): CONSOLE_MESSAGE_FORMAT = '%(levelname)s: %(message)s' DEFAULT_VERBOSE_LEVEL = 0 def __init__(self): - super(DesignateShell, self).__init__( - description='Designate Client', + super(TatuShell, self).__init__( + description='Tatu Client', version=version.version_string(), command_manager=CommandManager('tatuclient.cli'), ) @@ -53,7 +53,7 @@ class DesignateShell(App): self.log = logging.getLogger(__name__) def build_option_parser(self, description, version): - parser = super(DesignateShell, self).build_option_parser( + parser = super(TatuShell, self).build_option_parser( description, version) parser.add_argument('--os-username', @@ -138,12 +138,12 @@ class DesignateShell(App): 'Defaults to env[OS_SERVICE_TOKEN].') parser.add_argument('--os-endpoint', - default=env('OS_DNS_ENDPOINT', + default=env('OS_SSH_ENDPOINT', 'OS_SERVICE_ENDPOINT'), help='Specify an endpoint to use instead of ' 'retrieving one from the service catalog ' '(via authentication). ' - 'Defaults to env[OS_DNS_ENDPOINT].') + 'Defaults to env[OS_SSH_ENDPOINT].') parser.add_argument('--os-endpoint-type', default=env('OS_ENDPOINT_TYPE', @@ -151,9 +151,9 @@ class DesignateShell(App): help='Defaults to env[OS_ENDPOINT_TYPE].') parser.add_argument('--os-service-type', - default=env('OS_DNS_SERVICE_TYPE', default='dns'), - help=("Defaults to env[OS_DNS_SERVICE_TYPE], or " - "'dns'.")) + default=env('OS_SSH_SERVICE_TYPE', default='ssh'), + help=("Defaults to env[OS_SSH_SERVICE_TYPE], or " + "'ssh'.")) parser.add_argument('--os-cacert', default=env('OS_CACERT'), @@ -167,10 +167,6 @@ class DesignateShell(App): help="Allows to list all domains from all " "tenants.") - parser.add_argument('--edit-managed', action='store_true', - help='Allows to edit records that are marked as ' - 'managed.') - return parser def configure_logging(self): @@ -184,7 +180,7 @@ class DesignateShell(App): # Set this here so cliff.app.configure_logging() can work self.options.verbose_level = 3 - super(DesignateShell, self).configure_logging() + super(TatuShell, self).configure_logging() root_logger = logging.getLogger('') # Requests logs some stuff at INFO that we don't want @@ -218,7 +214,7 @@ class DesignateShell(App): self.dump_stack_trace = True def initialize_app(self, argv): - super(DesignateShell, self).initialize_app(argv) + super(TatuShell, self).initialize_app(argv) self.session = utils.get_session( auth_url=self.options.os_auth_url, endpoint=self.options.os_endpoint, @@ -241,7 +237,7 @@ class DesignateShell(App): def run(self, argv): try: - return super(DesignateShell, self).run(argv) + return super(TatuShell, self).run(argv) except Exception as e: if not logging.getLogger('').handlers: logging.basicConfig() diff --git a/tatuclient/tests/test_designateclient.py b/tatuclient/tests/test_tatuclient.py similarity index 97% rename from tatuclient/tests/test_designateclient.py rename to tatuclient/tests/test_tatuclient.py index d08214d..fcdf677 100644 --- a/tatuclient/tests/test_designateclient.py +++ b/tatuclient/tests/test_tatuclient.py @@ -11,7 +11,7 @@ # under the License. """ -test_designateclient +test_tatuclient ---------------------------------- Tests for `tatuclient` module. diff --git a/tatuclient/tests/v2/__init__.py b/tatuclient/tests/v1/__init__.py similarity index 96% rename from tatuclient/tests/v2/__init__.py rename to tatuclient/tests/v1/__init__.py index a29352f..2748025 100644 --- a/tatuclient/tests/v2/__init__.py +++ b/tatuclient/tests/v1/__init__.py @@ -49,5 +49,5 @@ class CrudMixin(object): self.assertIn(i, actual) -class APIV2TestCase(base.APITestCase): - VERSION = "2" +class APIV1TestCase(base.APITestCase): + VERSION = "1" diff --git a/tatuclient/tests/v2/test_recordsets.py b/tatuclient/tests/v1/test_ca.py similarity index 98% rename from tatuclient/tests/v2/test_recordsets.py rename to tatuclient/tests/v1/test_ca.py index 62cde35..8cee1a6 100644 --- a/tatuclient/tests/v2/test_recordsets.py +++ b/tatuclient/tests/v1/test_ca.py @@ -19,8 +19,8 @@ from mock import patch import testtools from tatuclient import exceptions -from tatuclient.tests import v2 -from tatuclient.v2 import zones +from tatuclient.tests import v1 +from tatuclient.v1 import zones ZONE = { "id": str(uuid.uuid4()), @@ -28,7 +28,7 @@ ZONE = { } -class TestRecordSets(v2.APIV2TestCase, v2.CrudMixin): +class TestRecordSets(v1.APIV1TestCase, v1.CrudMixin): RESOURCE = 'recordsets' def new_ref(self, **kwargs): diff --git a/tatuclient/tests/v2/test_client.py b/tatuclient/tests/v1/test_client.py similarity index 97% rename from tatuclient/tests/v2/test_client.py rename to tatuclient/tests/v1/test_client.py index 836919e..edd615e 100644 --- a/tatuclient/tests/v2/test_client.py +++ b/tatuclient/tests/v1/test_client.py @@ -18,7 +18,7 @@ from keystoneauth1 import adapter from keystoneauth1 import session as keystone_session from tatuclient.tests.base import TestCase -from tatuclient.v2.client import Client +from tatuclient.v1.client import Client class TestClient(TestCase): diff --git a/tatuclient/tests/v1/test_hostcert.py b/tatuclient/tests/v1/test_hostcert.py new file mode 100644 index 0000000..8cee1a6 --- /dev/null +++ b/tatuclient/tests/v1/test_hostcert.py @@ -0,0 +1,237 @@ +# Copyright 2015 Hewlett-Packard Development Company, L.P. +# +# Author: Endre Karlson +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +import uuid + +from mock import patch +import testtools + +from tatuclient import exceptions +from tatuclient.tests import v1 +from tatuclient.v1 import zones + +ZONE = { + "id": str(uuid.uuid4()), + "name": "example.com." +} + + +class TestRecordSets(v1.APIV1TestCase, v1.CrudMixin): + RESOURCE = 'recordsets' + + def new_ref(self, **kwargs): + ref = super(TestRecordSets, self).new_ref(**kwargs) + ref.setdefault("name", uuid.uuid4().hex) + ref.setdefault("type", "A") + ref.setdefault("records", ["10.0.0.1"]) + return ref + + def test_create_absolute_with_zone_dict(self): + ref = self.new_ref() + + parts = ["zones", ZONE["id"], self.RESOURCE] + self.stub_url("POST", parts=parts, json=ref) + + values = ref.copy() + del values["id"] + + self.client.recordsets.create( + ZONE, + "%s.%s" % (values["name"], ZONE["name"]), + values["type"], + values["records"]) + + values["name"] = "%s.%s" % (ref["name"], ZONE["name"]) + self.assertRequestBodyIs(json=values) + + @patch.object(zones.ZoneController, "get") + def test_create_absolute_with_zone_name(self, zone_get): + ref = self.new_ref() + + zone_get.return_value = ZONE + + parts = ["zones", ZONE["id"], self.RESOURCE] + self.stub_url("POST", parts=parts, json=ref) + + values = ref.copy() + del values["id"] + + self.client.recordsets.create( + ZONE["name"], + "%s.%s" % (values["name"], ZONE["name"]), + values["type"], + values["records"]) + + values["name"] = "%s.%s" % (ref["name"], ZONE["name"]) + self.assertRequestBodyIs(json=values) + + @patch.object(zones.ZoneController, "get") + def test_create_non_absolute_with_zone_name(self, zone_get): + ref = self.new_ref() + + zone_get.return_value = ZONE + + parts = ["zones", ZONE["id"], self.RESOURCE] + self.stub_url("POST", parts=parts, json=ref) + + values = ref.copy() + del values["id"] + + self.client.recordsets.create( + ZONE["name"], + values["name"], + values["type"], + values["records"]) + + values["name"] = "%s.%s" % (ref["name"], ZONE["name"]) + self.assertRequestBodyIs(json=values) + + @patch.object(zones.ZoneController, "list") + def test_create_non_absolute_with_zone_name_non_unique(self, zone_list): + zone_list.return_value = [ + 1, + 2 + ] + + ref = self.new_ref() + values = ref.copy() + del values["id"] + + with testtools.ExpectedException(exceptions.NoUniqueMatch): + self.client.recordsets.create( + ZONE["name"], + "%s.%s" % (values["name"], ZONE["name"]), + values["type"], + values["records"]) + + def test_create_absolute_with_zone_id(self): + ref = self.new_ref() + + parts = ["zones", ZONE["id"], self.RESOURCE] + self.stub_url("POST", parts=parts, json=ref) + + values = ref.copy() + del values["id"] + + self.client.recordsets.create( + ZONE["id"], + "%s.%s" % (values["name"], ZONE["name"]), + values["type"], + values["records"]) + + values["name"] = "%s.%s" % (ref["name"], ZONE["name"]) + self.assertRequestBodyIs(json=values) + + @patch.object(zones.ZoneController, "get") + def test_create_non_absolute_with_zone_id(self, zone_get): + ref = self.new_ref() + + zone_get.return_value = ZONE + + parts = ["zones", ZONE["id"], self.RESOURCE] + self.stub_url("POST", parts=parts, json=ref) + + values = ref.copy() + del values["id"] + + self.client.recordsets.create( + ZONE["id"], + values["name"], + values["type"], + values["records"]) + + values["name"] = "%s.%s" % (ref["name"], ZONE["name"]) + self.assertRequestBodyIs(json=values) + + def test_create_with_description(self): + ref = self.new_ref(description="Foo") + + parts = ["zones", ZONE["id"], self.RESOURCE] + self.stub_url("POST", parts=parts, json=ref) + + values = ref.copy() + del values["id"] + + self.client.recordsets.create( + ZONE["id"], + "%s.%s" % (values["name"], ZONE["name"]), + values["type"], + values["records"], + description=values["description"]) + + values["name"] = "%s.%s" % (ref["name"], ZONE["name"]) + self.assertRequestBodyIs(json=values) + + def test_create_with_ttl(self): + ref = self.new_ref(ttl=60) + + parts = ["zones", ZONE["id"], self.RESOURCE] + self.stub_url("POST", parts=parts, json=ref) + + values = ref.copy() + del values["id"] + + self.client.recordsets.create( + ZONE["id"], + "%s.%s" % (values["name"], ZONE["name"]), + values["type"], + values["records"], + ttl=values["ttl"]) + + values["name"] = "%s.%s" % (ref["name"], ZONE["name"]) + self.assertRequestBodyIs(json=values) + + def test_get(self): + ref = self.new_ref() + + parts = ["zones", ZONE["id"], self.RESOURCE] + self.stub_entity("GET", entity=ref, id=ref["id"], parts=parts) + + response = self.client.recordsets.get(ZONE["id"], ref["id"]) + self.assertEqual(ref, response) + + def test_list(self): + items = [ + self.new_ref(), + self.new_ref() + ] + + parts = ["zones", ZONE["id"], self.RESOURCE] + self.stub_url("GET", parts=parts, json={"recordsets": items}) + + listed = self.client.recordsets.list(ZONE["id"]) + self.assertList(items, listed) + self.assertQueryStringIs("") + + def test_update(self): + ref = self.new_ref() + + parts = ["zones", ZONE["id"], self.RESOURCE] + self.stub_entity("PUT", entity=ref, id=ref["id"], parts=parts) + + values = ref.copy() + del values["id"] + + self.client.recordsets.update(ZONE["id"], ref["id"], values) + self.assertRequestBodyIs(json=values) + + def test_delete(self): + ref = self.new_ref() + + parts = ["zones", ZONE["id"], self.RESOURCE] + self.stub_entity("DELETE", id=ref["id"], parts=parts) + + self.client.recordsets.delete(ZONE["id"], ref["id"]) + self.assertRequestBodyIs(None) diff --git a/tatuclient/tests/v2/test_timeout.py b/tatuclient/tests/v1/test_timeout.py similarity index 96% rename from tatuclient/tests/v2/test_timeout.py rename to tatuclient/tests/v1/test_timeout.py index db66f2c..36b8879 100644 --- a/tatuclient/tests/v2/test_timeout.py +++ b/tatuclient/tests/v1/test_timeout.py @@ -18,8 +18,8 @@ from keystoneauth1.identity import generic from keystoneauth1 import session as keystone_session from mock import Mock -from tatuclient.tests import v2 -from tatuclient.v2.client import Client +from tatuclient.tests import v1 +from tatuclient.v1.client import Client def create_session(timeout=None): @@ -28,7 +28,7 @@ def create_session(timeout=None): return keystone_session.Session(auth=auth, timeout=timeout) -class TestTimeout(v2.APIV2TestCase, v2.CrudMixin): +class TestTimeout(v1.APIV1TestCase, v1.CrudMixin): def setUp(self): super(TestTimeout, self).setUp() diff --git a/tatuclient/tests/v1/test_usercert.py b/tatuclient/tests/v1/test_usercert.py new file mode 100644 index 0000000..8cee1a6 --- /dev/null +++ b/tatuclient/tests/v1/test_usercert.py @@ -0,0 +1,237 @@ +# Copyright 2015 Hewlett-Packard Development Company, L.P. +# +# Author: Endre Karlson +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +import uuid + +from mock import patch +import testtools + +from tatuclient import exceptions +from tatuclient.tests import v1 +from tatuclient.v1 import zones + +ZONE = { + "id": str(uuid.uuid4()), + "name": "example.com." +} + + +class TestRecordSets(v1.APIV1TestCase, v1.CrudMixin): + RESOURCE = 'recordsets' + + def new_ref(self, **kwargs): + ref = super(TestRecordSets, self).new_ref(**kwargs) + ref.setdefault("name", uuid.uuid4().hex) + ref.setdefault("type", "A") + ref.setdefault("records", ["10.0.0.1"]) + return ref + + def test_create_absolute_with_zone_dict(self): + ref = self.new_ref() + + parts = ["zones", ZONE["id"], self.RESOURCE] + self.stub_url("POST", parts=parts, json=ref) + + values = ref.copy() + del values["id"] + + self.client.recordsets.create( + ZONE, + "%s.%s" % (values["name"], ZONE["name"]), + values["type"], + values["records"]) + + values["name"] = "%s.%s" % (ref["name"], ZONE["name"]) + self.assertRequestBodyIs(json=values) + + @patch.object(zones.ZoneController, "get") + def test_create_absolute_with_zone_name(self, zone_get): + ref = self.new_ref() + + zone_get.return_value = ZONE + + parts = ["zones", ZONE["id"], self.RESOURCE] + self.stub_url("POST", parts=parts, json=ref) + + values = ref.copy() + del values["id"] + + self.client.recordsets.create( + ZONE["name"], + "%s.%s" % (values["name"], ZONE["name"]), + values["type"], + values["records"]) + + values["name"] = "%s.%s" % (ref["name"], ZONE["name"]) + self.assertRequestBodyIs(json=values) + + @patch.object(zones.ZoneController, "get") + def test_create_non_absolute_with_zone_name(self, zone_get): + ref = self.new_ref() + + zone_get.return_value = ZONE + + parts = ["zones", ZONE["id"], self.RESOURCE] + self.stub_url("POST", parts=parts, json=ref) + + values = ref.copy() + del values["id"] + + self.client.recordsets.create( + ZONE["name"], + values["name"], + values["type"], + values["records"]) + + values["name"] = "%s.%s" % (ref["name"], ZONE["name"]) + self.assertRequestBodyIs(json=values) + + @patch.object(zones.ZoneController, "list") + def test_create_non_absolute_with_zone_name_non_unique(self, zone_list): + zone_list.return_value = [ + 1, + 2 + ] + + ref = self.new_ref() + values = ref.copy() + del values["id"] + + with testtools.ExpectedException(exceptions.NoUniqueMatch): + self.client.recordsets.create( + ZONE["name"], + "%s.%s" % (values["name"], ZONE["name"]), + values["type"], + values["records"]) + + def test_create_absolute_with_zone_id(self): + ref = self.new_ref() + + parts = ["zones", ZONE["id"], self.RESOURCE] + self.stub_url("POST", parts=parts, json=ref) + + values = ref.copy() + del values["id"] + + self.client.recordsets.create( + ZONE["id"], + "%s.%s" % (values["name"], ZONE["name"]), + values["type"], + values["records"]) + + values["name"] = "%s.%s" % (ref["name"], ZONE["name"]) + self.assertRequestBodyIs(json=values) + + @patch.object(zones.ZoneController, "get") + def test_create_non_absolute_with_zone_id(self, zone_get): + ref = self.new_ref() + + zone_get.return_value = ZONE + + parts = ["zones", ZONE["id"], self.RESOURCE] + self.stub_url("POST", parts=parts, json=ref) + + values = ref.copy() + del values["id"] + + self.client.recordsets.create( + ZONE["id"], + values["name"], + values["type"], + values["records"]) + + values["name"] = "%s.%s" % (ref["name"], ZONE["name"]) + self.assertRequestBodyIs(json=values) + + def test_create_with_description(self): + ref = self.new_ref(description="Foo") + + parts = ["zones", ZONE["id"], self.RESOURCE] + self.stub_url("POST", parts=parts, json=ref) + + values = ref.copy() + del values["id"] + + self.client.recordsets.create( + ZONE["id"], + "%s.%s" % (values["name"], ZONE["name"]), + values["type"], + values["records"], + description=values["description"]) + + values["name"] = "%s.%s" % (ref["name"], ZONE["name"]) + self.assertRequestBodyIs(json=values) + + def test_create_with_ttl(self): + ref = self.new_ref(ttl=60) + + parts = ["zones", ZONE["id"], self.RESOURCE] + self.stub_url("POST", parts=parts, json=ref) + + values = ref.copy() + del values["id"] + + self.client.recordsets.create( + ZONE["id"], + "%s.%s" % (values["name"], ZONE["name"]), + values["type"], + values["records"], + ttl=values["ttl"]) + + values["name"] = "%s.%s" % (ref["name"], ZONE["name"]) + self.assertRequestBodyIs(json=values) + + def test_get(self): + ref = self.new_ref() + + parts = ["zones", ZONE["id"], self.RESOURCE] + self.stub_entity("GET", entity=ref, id=ref["id"], parts=parts) + + response = self.client.recordsets.get(ZONE["id"], ref["id"]) + self.assertEqual(ref, response) + + def test_list(self): + items = [ + self.new_ref(), + self.new_ref() + ] + + parts = ["zones", ZONE["id"], self.RESOURCE] + self.stub_url("GET", parts=parts, json={"recordsets": items}) + + listed = self.client.recordsets.list(ZONE["id"]) + self.assertList(items, listed) + self.assertQueryStringIs("") + + def test_update(self): + ref = self.new_ref() + + parts = ["zones", ZONE["id"], self.RESOURCE] + self.stub_entity("PUT", entity=ref, id=ref["id"], parts=parts) + + values = ref.copy() + del values["id"] + + self.client.recordsets.update(ZONE["id"], ref["id"], values) + self.assertRequestBodyIs(json=values) + + def test_delete(self): + ref = self.new_ref() + + parts = ["zones", ZONE["id"], self.RESOURCE] + self.stub_entity("DELETE", id=ref["id"], parts=parts) + + self.client.recordsets.delete(ZONE["id"], ref["id"]) + self.assertRequestBodyIs(None) diff --git a/tatuclient/tests/v2/test_blacklists.py b/tatuclient/tests/v2/test_blacklists.py deleted file mode 100644 index 6a3b353..0000000 --- a/tatuclient/tests/v2/test_blacklists.py +++ /dev/null @@ -1,88 +0,0 @@ -# Copyright 2015 Hewlett-Packard Development Company, L.P. -# -# Author: Endre Karlson -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -import uuid - -from tatuclient.tests import v2 - - -class TestBlacklists(v2.APIV2TestCase, v2.CrudMixin): - RESOURCE = 'blacklists' - - def new_ref(self, **kwargs): - ref = super(TestBlacklists, self).new_ref(**kwargs) - ref.setdefault("pattern", uuid.uuid4().hex) - return ref - - def test_create(self): - ref = self.new_ref() - - self.stub_url("POST", parts=[self.RESOURCE], json=ref) - - values = ref.copy() - del values["id"] - - self.client.blacklists.create(**values) - self.assertRequestBodyIs(json=values) - - def test_create_with_description(self): - ref = self.new_ref(description="My Blacklist") - - self.stub_url("POST", parts=[self.RESOURCE], json=ref) - - values = ref.copy() - del values["id"] - - self.client.blacklists.create(**values) - self.assertRequestBodyIs(json=values) - - def test_get(self): - ref = self.new_ref() - - self.stub_entity("GET", entity=ref, id=ref["id"]) - - response = self.client.blacklists.get(ref["id"]) - self.assertEqual(ref, response) - - def test_list(self): - items = [ - self.new_ref(), - self.new_ref() - ] - - self.stub_url("GET", parts=[self.RESOURCE], json={"blacklists": items}) - - listed = self.client.blacklists.list() - self.assertList(items, listed) - self.assertQueryStringIs("") - - def test_update(self): - ref = self.new_ref() - - self.stub_entity("PATCH", entity=ref, id=ref["id"]) - - values = ref.copy() - del values["id"] - - self.client.blacklists.update(ref["id"], values) - self.assertRequestBodyIs(json=values) - - def test_delete(self): - ref = self.new_ref() - - self.stub_entity("DELETE", id=ref["id"]) - - self.client.blacklists.delete(ref["id"]) - self.assertRequestBodyIs(None) diff --git a/tatuclient/tests/v2/test_limits.py b/tatuclient/tests/v2/test_limits.py deleted file mode 100644 index 71dd14d..0000000 --- a/tatuclient/tests/v2/test_limits.py +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright 2015 Hewlett-Packard Development Company, L.P. -# -# Author: Endre Karlson -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -from tatuclient.tests import v2 - - -class TestLimits(v2.APIV2TestCase, v2.CrudMixin): - def test_get(self): - ref = {"max_zones": "foo"} - self.stub_url("GET", parts=["limits"], json=ref) - - limits = self.client.limits.get() - self.assertEqual(ref, limits) diff --git a/tatuclient/tests/v2/test_nameservers.py b/tatuclient/tests/v2/test_nameservers.py deleted file mode 100644 index f61c502..0000000 --- a/tatuclient/tests/v2/test_nameservers.py +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright 2015 Hewlett-Packard Development Company, L.P. -# -# Author: Endre Karlson -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -from mock import patch - -from tatuclient.tests import v2 -from tatuclient.v2 import zones - - -class TestLimits(v2.APIV2TestCase, v2.CrudMixin): - @patch.object(zones.ZoneController, "list") - def test_get(self, zones_get): - zones_get.return_value = [{"id": "foo"}] - - ref = [{ - "hostname": "ns1.example.com.", - "priority": 1 - }] - parts = ["zones", "foo", "nameservers"] - self.stub_url("GET", parts=parts, json={"nameservers": ref}) - - response = self.client.nameservers.list("foo") - self.assertEqual(ref, response) diff --git a/tatuclient/tests/v2/test_reverse.py b/tatuclient/tests/v2/test_reverse.py deleted file mode 100644 index e313367..0000000 --- a/tatuclient/tests/v2/test_reverse.py +++ /dev/null @@ -1,62 +0,0 @@ -# Copyright 2015 Hewlett-Packard Development Company, L.P. -# -# Author: Endre Karlson -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -import uuid - -from tatuclient.tests import v2 - -FIP_ID = '%s:%s' % (str(uuid.uuid4()), "RegionOne") - - -class TestFloatingIP(v2.APIV2TestCase, v2.CrudMixin): - def test_set(self): - name = "foo.com." - - ref = { - "ptrdname": name, - "description": "foo" - } - - parts = ["reverse", "floatingips", FIP_ID] - self.stub_url("PATCH", parts=parts, json=ref) - - self.client.floatingips.set(FIP_ID, name, "foo") - - def test_list(self): - ref = [ - {"ptrdname": "foo.com."} - ] - - self.stub_url("GET", parts=["reverse", "floatingips"], - json={"floatingips": ref}) - - self.client.floatingips.list() - - def test_get(self): - ref = { - "ptrdname": "foo.com." - } - - parts = ["reverse", "floatingips", FIP_ID] - self.stub_url("GET", parts=parts, json=ref) - - self.client.floatingips.get(FIP_ID) - - def test_unset(self): - parts = ["reverse", "floatingips", FIP_ID] - self.stub_url("PATCH", parts=parts, json={"ptdrname": None}) - - self.client.floatingips.unset(FIP_ID) - self.assertRequestBodyIs(None) diff --git a/tatuclient/tests/v2/test_service_statuses.py b/tatuclient/tests/v2/test_service_statuses.py deleted file mode 100644 index 5e05d6c..0000000 --- a/tatuclient/tests/v2/test_service_statuses.py +++ /dev/null @@ -1,46 +0,0 @@ -# Copyright 2016 Hewlett Packard Enterprise Development Company LP -# -# Author: Endre Karlson -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -from tatuclient.tests import v2 - - -class TestServiceStatuses(v2.APIV2TestCase, v2.CrudMixin): - RESOURCE = 'service_statuses' - - def new_ref(self, **kwargs): - ref = super(TestServiceStatuses, self).new_ref(**kwargs) - ref["name"] = "foo" - return ref - - def test_get(self): - ref = self.new_ref() - - self.stub_entity("GET", entity=ref, id=ref["id"]) - - response = self.client.service_statuses.get(ref["id"]) - self.assertEqual(ref, response) - - def test_list(self): - items = [ - self.new_ref(), - self.new_ref() - ] - - self.stub_url("GET", parts=[self.RESOURCE], - json={"service_statuses": items}) - - listed = self.client.service_statuses.list() - self.assertList(items, listed) - self.assertQueryStringIs("") diff --git a/tatuclient/tests/v2/test_tlds.py b/tatuclient/tests/v2/test_tlds.py deleted file mode 100644 index addc60b..0000000 --- a/tatuclient/tests/v2/test_tlds.py +++ /dev/null @@ -1,103 +0,0 @@ -# Copyright 2015 Hewlett-Packard Development Company, L.P. -# -# Author: Endre Karlson -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -import uuid - -from tatuclient.tests import v2 - - -class TestTlds(v2.APIV2TestCase, v2.CrudMixin): - RESOURCE = 'tlds' - - def new_ref(self, **kwargs): - ref = super(TestTlds, self).new_ref(**kwargs) - ref.setdefault("name", uuid.uuid4().hex) - return ref - - def test_create(self): - ref = self.new_ref() - - self.stub_url("POST", parts=[self.RESOURCE], json=ref) - - values = ref.copy() - del values["id"] - - self.client.tlds.create(**values) - self.assertRequestBodyIs(json=values) - - def test_create_with_description(self): - ref = self.new_ref(description="My TLD") - - self.stub_url("POST", parts=[self.RESOURCE], json=ref) - - values = ref.copy() - del values["id"] - - self.client.tlds.create(**values) - self.assertRequestBodyIs(json=values) - - def test_get(self): - ref = self.new_ref() - - self.stub_entity("GET", entity=ref, id=ref["id"]) - - response = self.client.tlds.get(ref["id"]) - self.assertEqual(ref, response) - - def test_get_by_name(self): - ref = self.new_ref(name="www") - - self.stub_entity("GET", entity=ref, id=ref["id"]) - self.stub_url("GET", parts=[self.RESOURCE], json={"tlds": [ref]}) - - response = self.client.tlds.get(ref['name']) - - self.assertEqual("GET", self.requests.request_history[0].method) - self.assertEqual( - "http://127.0.0.1:9001/v2/tlds?name=www", - self.requests.request_history[0].url) - - self.assertEqual(ref, response) - - def test_list(self): - items = [ - self.new_ref(), - self.new_ref() - ] - - self.stub_url("GET", parts=[self.RESOURCE], json={"tlds": items}) - - listed = self.client.tlds.list() - self.assertList(items, listed) - self.assertQueryStringIs("") - - def test_update(self): - ref = self.new_ref() - - self.stub_entity("PATCH", entity=ref, id=ref["id"]) - - values = ref.copy() - del values["id"] - - self.client.tlds.update(ref["id"], values) - self.assertRequestBodyIs(json=values) - - def test_delete(self): - ref = self.new_ref() - - self.stub_entity("DELETE", id=ref["id"]) - - self.client.tlds.delete(ref["id"]) - self.assertRequestBodyIs(None) diff --git a/tatuclient/tests/v2/test_tsigkeys.py b/tatuclient/tests/v2/test_tsigkeys.py deleted file mode 100644 index a643173..0000000 --- a/tatuclient/tests/v2/test_tsigkeys.py +++ /dev/null @@ -1,96 +0,0 @@ -# Copyright 2017 SAP SE -# -# Author: Rudolf Vriend -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -import uuid - -from tatuclient.tests import v2 - - -class TestTSIGKeys(v2.APIV2TestCase, v2.CrudMixin): - RESOURCE = 'tsigkeys' - - def new_ref(self, **kwargs): - ref = super(TestTSIGKeys, self).new_ref(**kwargs) - ref.setdefault("name", uuid.uuid4().hex) - ref.setdefault("algorithm", "hmac-sha256") - ref.setdefault("secret", uuid.uuid4().hex) - ref.setdefault("scope", "POOL") - ref.setdefault("resource_id", uuid.uuid4().hex) - return ref - - def test_create(self): - ref = self.new_ref() - - self.stub_url("POST", parts=[self.RESOURCE], json=ref) - - values = ref.copy() - del values["id"] - - self.client.tsigkeys.create(**values) - self.assertRequestBodyIs(json=values) - - def test_get(self): - ref = self.new_ref() - - self.stub_entity("GET", entity=ref, id=ref["id"]) - - response = self.client.tsigkeys.get(ref["id"]) - self.assertEqual(ref, response) - - def test_get_by_name(self): - ref = self.new_ref(name="www") - - self.stub_entity("GET", entity=ref, id=ref["id"]) - self.stub_url("GET", parts=[self.RESOURCE], json={"tsigkeys": [ref]}) - - response = self.client.tsigkeys.get(ref['name']) - - self.assertEqual("GET", self.requests.request_history[0].method) - self.assertEqual( - "http://127.0.0.1:9001/v2/tsigkeys?name=www", - self.requests.request_history[0].url) - - self.assertEqual(ref, response) - - def test_list(self): - items = [ - self.new_ref(), - self.new_ref() - ] - - self.stub_url("GET", parts=[self.RESOURCE], json={"tsigkeys": items}) - - listed = self.client.tsigkeys.list() - self.assertList(items, listed) - self.assertQueryStringIs("") - - def test_update(self): - ref = self.new_ref() - - self.stub_entity("PATCH", entity=ref, id=ref["id"]) - - values = ref.copy() - del values["id"] - - self.client.tsigkeys.update(ref["id"], values) - self.assertRequestBodyIs(json=values) - - def test_delete(self): - ref = self.new_ref() - - self.stub_entity("DELETE", id=ref["id"]) - - self.client.tsigkeys.delete(ref["id"]) - self.assertRequestBodyIs(None) diff --git a/tatuclient/tests/v2/test_zones.py b/tatuclient/tests/v2/test_zones.py deleted file mode 100644 index 2410623..0000000 --- a/tatuclient/tests/v2/test_zones.py +++ /dev/null @@ -1,382 +0,0 @@ -# Copyright 2015 Hewlett-Packard Development Company, L.P. -# -# Author: Endre Karlson -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -import time -import uuid - -from tatuclient.tests import v2 - - -class TestZones(v2.APIV2TestCase, v2.CrudMixin): - RESOURCE = 'zones' - - def new_ref(self, **kwargs): - ref = super(TestZones, self).new_ref(**kwargs) - ref.setdefault("name", uuid.uuid4().hex) - ref.setdefault("type", "PRIMARY") - return ref - - def test_create_with_description(self): - ref = self.new_ref(email="root@example.com", description="Foo") - self.stub_url("POST", parts=[self.RESOURCE], json=ref) - - values = ref.copy() - del values["id"] - - self.client.zones.create( - values["name"], - email=values["email"], - description=values["description"]) - self.assertRequestBodyIs(json=values) - - def test_create_primary(self): - ref = self.new_ref(email="root@example.com") - self.stub_url("POST", parts=[self.RESOURCE], json=ref) - - values = ref.copy() - del values["id"] - - self.client.zones.create( - values["name"], - email=values["email"]) - self.assertRequestBodyIs(json=values) - - def test_create_primary_with_ttl(self): - ref = self.new_ref(email="root@example.com", ttl=60) - self.stub_url("POST", parts=[self.RESOURCE], json=ref) - - values = ref.copy() - del values["id"] - - self.client.zones.create( - values["name"], - email=values["email"], - ttl=values["ttl"]) - self.assertRequestBodyIs(json=values) - - def test_create_secondary(self): - ref = self.new_ref(type="SECONDARY", masters=["10.0.0.1"]) - self.stub_url("POST", parts=[self.RESOURCE], json=ref) - - values = ref.copy() - del values["id"] - - self.client.zones.create( - values["name"], - type_=values["type"], - masters=values["masters"]) - self.assertRequestBodyIs(json=values) - - def test_get(self): - ref = self.new_ref() - - self.stub_entity("GET", entity=ref, id=ref["id"]) - - response = self.client.zones.get(ref["id"]) - self.assertEqual(ref, response) - - def test_list(self): - items = [ - self.new_ref(), - self.new_ref() - ] - - self.stub_url("GET", parts=[self.RESOURCE], json={"zones": items}) - - listed = self.client.zones.list() - self.assertList(items, listed) - self.assertQueryStringIs("") - - def test_update(self): - ref = self.new_ref() - - self.stub_entity("PATCH", entity=ref, id=ref["id"]) - - values = ref.copy() - del values["id"] - - self.client.zones.update(ref["id"], values) - self.assertRequestBodyIs(json=values) - - def test_delete(self): - ref = self.new_ref() - - self.stub_entity("DELETE", id=ref["id"]) - - self.client.zones.delete(ref["id"]) - self.assertRequestBodyIs(None) - - def test_task_abandon(self): - ref = self.new_ref() - - parts = [self.RESOURCE, ref["id"], "tasks", "abandon"] - self.stub_url("POST", parts=parts) - - self.client.zones.abandon(ref["id"]) - self.assertRequestBodyIs(None) - - def test_task_axfr(self): - ref = self.new_ref() - - parts = [self.RESOURCE, ref["id"], "tasks", "xfr"] - self.stub_url("POST", parts=parts) - - self.client.zones.axfr(ref["id"]) - self.assertRequestBodyIs(None) - - -class TestZoneTransfers(v2.APIV2TestCase, v2.CrudMixin): - def test_create_request(self): - zone = "098bee04-fe30-4a83-8ccd-e0c496755816" - project = "123" - - ref = { - "target_project_id": project - } - - parts = ["zones", zone, "tasks", "transfer_requests"] - self.stub_url('POST', parts=parts, json=ref) - - self.client.zone_transfers.create_request(zone, project) - self.assertRequestBodyIs(json=ref) - - def test_create_request_with_description(self): - zone = "098bee04-fe30-4a83-8ccd-e0c496755816" - project = "123" - - ref = { - "target_project_id": project, - "description": "My Foo" - } - - parts = ["zones", zone, "tasks", "transfer_requests"] - self.stub_url('POST', parts=parts, json=ref) - - self.client.zone_transfers.create_request( - zone, project, ref["description"]) - self.assertRequestBodyIs(json=ref) - - def test_get_request(self): - transfer = "098bee04-fe30-4a83-8ccd-e0c496755816" - project = "098bee04-fe30-4a83-8ccd-e0c496755817" - - ref = { - "target_project_id": project - } - - parts = ["zones", "tasks", "transfer_requests", transfer] - self.stub_url('GET', parts=parts, json=ref) - - self.client.zone_transfers.get_request(transfer) - self.assertRequestBodyIs("") - - def test_list_request(self): - project = "098bee04-fe30-4a83-8ccd-e0c496755817" - - ref = [{ - "target_project_id": project - }] - - parts = ["zones", "tasks", "transfer_requests"] - self.stub_url('GET', parts=parts, json={"transfer_requests": ref}) - - self.client.zone_transfers.list_requests() - self.assertRequestBodyIs("") - - def test_update_request(self): - transfer = "098bee04-fe30-4a83-8ccd-e0c496755816" - project = "098bee04-fe30-4a83-8ccd-e0c496755817" - - ref = { - "target_project_id": project - } - - parts = ["zones", "tasks", "transfer_requests", transfer] - self.stub_url('PATCH', parts=parts, json=ref) - - self.client.zone_transfers.update_request(transfer, ref) - self.assertRequestBodyIs(json=ref) - - def test_delete_request(self): - transfer = "098bee04-fe30-4a83-8ccd-e0c496755816" - - parts = ["zones", "tasks", "transfer_requests", transfer] - self.stub_url('DELETE', parts=parts) - - self.client.zone_transfers.delete_request(transfer) - self.assertRequestBodyIs("") - - def test_accept_request(self): - transfer = "098bee04-fe30-4a83-8ccd-e0c496755816" - key = "foo123" - - ref = { - "status": "COMPLETE" - } - - parts = ["zones", "tasks", "transfer_accepts"] - self.stub_url('POST', parts=parts, json=ref) - - request = { - "key": key, - "zone_transfer_request_id": transfer - } - self.client.zone_transfers.accept_request(transfer, key) - self.assertRequestBodyIs(json=request) - - def test_get_accept(self): - accept_id = "098bee04-fe30-4a83-8ccd-e0c496755816" - - ref = { - "status": "COMPLETE" - } - - parts = ["zones", "tasks", "transfer_accepts", accept_id] - self.stub_url('GET', parts=parts, json=ref) - - response = self.client.zone_transfers.get_accept(accept_id) - self.assertEqual(ref, response) - - def test_list_accepts(self): - accept_id = "098bee04-fe30-4a83-8ccd-e0c496755816" - - ref = { - "id": accept_id, - "status": "COMPLETE" - } - - parts = ["zones", "tasks", "transfer_accepts"] - self.stub_url('GET', parts=parts, json={"transfer_accepts": ref}) - - self.client.zone_transfers.list_accepts() - self.assertRequestBodyIs("") - - -class TestZoneExports(v2.APIV2TestCase, v2.CrudMixin): - def new_ref(self, **kwargs): - ref = super(TestZoneExports, self).new_ref(**kwargs) - ref.setdefault("zone_id", uuid.uuid4().hex) - ref.setdefault("created_at", time.strftime("%c")) - ref.setdefault("updated_at", time.strftime("%c")) - ref.setdefault("status", 'PENDING') - ref.setdefault("version", '1') - return ref - - def test_create_export(self): - zone = uuid.uuid4().hex - ref = {} - - parts = ["zones", zone, "tasks", "export"] - self.stub_url('POST', parts=parts, json=ref) - - self.client.zone_exports.create(zone) - self.assertRequestBodyIs(json=ref) - - def test_get_export(self): - ref = self.new_ref() - - parts = ["zones", "tasks", "exports", ref["id"]] - self.stub_url('GET', parts=parts, json=ref) - self.stub_entity("GET", parts=parts, entity=ref, id=ref["id"]) - - response = self.client.zone_exports.get_export_record(ref["id"]) - self.assertEqual(ref, response) - - def test_list_exports(self): - items = [ - self.new_ref(), - self.new_ref() - ] - - parts = ["zones", "tasks", "exports"] - self.stub_url('GET', parts=parts, json={"exports": items}) - - listed = self.client.zone_exports.list() - self.assertList(items, listed["exports"]) - self.assertQueryStringIs("") - - def test_delete_export(self): - ref = self.new_ref() - - parts = ["zones", "tasks", "exports", ref["id"]] - self.stub_url('DELETE', parts=parts, json=ref) - self.stub_entity("DELETE", parts=parts, id=ref["id"]) - - self.client.zone_exports.delete(ref["id"]) - self.assertRequestBodyIs(None) - - def test_get_export_file(self): - ref = self.new_ref() - - parts = ["zones", "tasks", "exports", ref["id"], "export"] - self.stub_url('GET', parts=parts, json=ref) - self.stub_entity("GET", parts=parts, entity=ref, id=ref["id"]) - - response = self.client.zone_exports.get_export(ref["id"]) - self.assertEqual(ref, response) - - -class TestZoneImports(v2.APIV2TestCase, v2.CrudMixin): - def new_ref(self, **kwargs): - ref = super(TestZoneImports, self).new_ref(**kwargs) - ref.setdefault("zone_id", uuid.uuid4().hex) - ref.setdefault("created_at", time.strftime("%c")) - ref.setdefault("updated_at", time.strftime("%c")) - ref.setdefault("status", 'PENDING') - ref.setdefault("message", 'Importing...') - ref.setdefault("version", '1') - return ref - - def test_create_import(self): - zonefile = '$ORIGIN example.com' - - parts = ["zones", "tasks", "imports"] - self.stub_url('POST', parts=parts, json=zonefile) - - self.client.zone_imports.create(zonefile) - self.assertRequestBodyIs(body=zonefile) - - def test_get_import(self): - ref = self.new_ref() - - parts = ["zones", "tasks", "imports", ref["id"]] - self.stub_url('GET', parts=parts, json=ref) - self.stub_entity("GET", parts=parts, entity=ref, id=ref["id"]) - - response = self.client.zone_imports.get_import_record(ref["id"]) - self.assertEqual(ref, response) - - def test_list_imports(self): - items = [ - self.new_ref(), - self.new_ref() - ] - - parts = ["zones", "tasks", "imports"] - self.stub_url('GET', parts=parts, json={"imports": items}) - - listed = self.client.zone_imports.list() - self.assertList(items, listed["imports"]) - self.assertQueryStringIs("") - - def test_delete_import(self): - ref = self.new_ref() - - parts = ["zones", "tasks", "imports", ref["id"]] - self.stub_url('DELETE', parts=parts, json=ref) - self.stub_entity("DELETE", parts=parts, id=ref["id"]) - - self.client.zone_imports.delete(ref["id"]) - self.assertRequestBodyIs(None) diff --git a/tatuclient/utils.py b/tatuclient/utils.py index 7faa6e4..f4fd5ad 100644 --- a/tatuclient/utils.py +++ b/tatuclient/utils.py @@ -181,7 +181,7 @@ class AdapterWithTimeout(adapter.Adapter): """adapter.Adapter wraps around a Session. The user can pass a timeout keyword that will apply only to - the Designate Client, in order: + the Tatu Client, in order: - timeout keyword passed to ``request()`` - timeout keyword passed to ``AdapterWithTimeout()`` diff --git a/tatuclient/v2/__init__.py b/tatuclient/v1/__init__.py similarity index 100% rename from tatuclient/v2/__init__.py rename to tatuclient/v1/__init__.py diff --git a/tatuclient/v2/base.py b/tatuclient/v1/base.py similarity index 88% rename from tatuclient/v2/base.py rename to tatuclient/v1/base.py index b23bbbb..013548f 100644 --- a/tatuclient/v2/base.py +++ b/tatuclient/v1/base.py @@ -15,22 +15,22 @@ # under the License. from tatuclient import client -from tatuclient.v2.utils import parse_query_from_url +from tatuclient.v1.utils import parse_query_from_url -class DesignateList(list): +class TatuList(list): next_link_criterion = {} next_page = False -class V2Controller(client.Controller): +class V1Controller(client.Controller): def _get(self, url, response_key=None, **kwargs): resp, body = self.client.session.get(url, **kwargs) if response_key is not None: - data = DesignateList() + data = TatuList() data.extend(body[response_key]) if 'next' in body.get('links', {}): diff --git a/tatuclient/v2/ca.py b/tatuclient/v1/ca.py similarity index 83% rename from tatuclient/v2/ca.py rename to tatuclient/v1/ca.py index 2d3fd18..11e72ea 100644 --- a/tatuclient/v2/ca.py +++ b/tatuclient/v1/ca.py @@ -16,11 +16,11 @@ from oslo_utils import uuidutils import six -from tatuclient.v2.base import V2Controller -from tatuclient.v2 import utils as v2_utils +from tatuclient.v1.base import V1Controller +from tatuclient.v1 import utils as v1_utils -class RecordSetController(V2Controller): +class RecordSetController(V1Controller): def _canonicalize_record_name(self, zone, name): zone_info = None @@ -66,7 +66,7 @@ class RecordSetController(V2Controller): return self._post(url, data=data) def list(self, zone, criterion=None, marker=None, limit=None): - zone = v2_utils.resolve_by_name(self.client.zones.list, zone) + zone = v1_utils.resolve_by_name(self.client.zones.list, zone) url = self.build_url( '/zones/%s/recordsets' % zone, @@ -81,8 +81,8 @@ class RecordSetController(V2Controller): return self._get(url, response_key='recordsets') def get(self, zone, recordset): - zone = v2_utils.resolve_by_name(self.client.zones.list, zone) - recordset = v2_utils.resolve_by_name(self.list, recordset, zone) + zone = v1_utils.resolve_by_name(self.client.zones.list, zone) + recordset = v1_utils.resolve_by_name(self.list, recordset, zone) url = self.build_url('/zones/%s/recordsets/%s' % ( zone, recordset)) @@ -90,16 +90,16 @@ class RecordSetController(V2Controller): return self._get(url) def update(self, zone, recordset, values): - zone = v2_utils.resolve_by_name(self.client.zones.list, zone) - recordset = v2_utils.resolve_by_name(self.list, recordset, zone) + zone = v1_utils.resolve_by_name(self.client.zones.list, zone) + recordset = v1_utils.resolve_by_name(self.list, recordset, zone) url = '/zones/%s/recordsets/%s' % (zone, recordset) return self._put(url, data=values) def delete(self, zone, recordset): - zone = v2_utils.resolve_by_name(self.client.zones.list, zone) - recordset = v2_utils.resolve_by_name(self.list, recordset, zone) + zone = v1_utils.resolve_by_name(self.client.zones.list, zone) + recordset = v1_utils.resolve_by_name(self.list, recordset, zone) url = '/zones/%s/recordsets/%s' % (zone, recordset) diff --git a/tatuclient/v2/cli/__init__.py b/tatuclient/v1/cli/__init__.py similarity index 100% rename from tatuclient/v2/cli/__init__.py rename to tatuclient/v1/cli/__init__.py diff --git a/tatuclient/v2/cli/ca.py b/tatuclient/v1/cli/ca.py similarity index 95% rename from tatuclient/v2/cli/ca.py rename to tatuclient/v1/cli/ca.py index 3926556..da1da17 100644 --- a/tatuclient/v2/cli/ca.py +++ b/tatuclient/v1/cli/ca.py @@ -21,8 +21,8 @@ from osc_lib.command import command import six from tatuclient import utils -from tatuclient.v2.cli import common -from tatuclient.v2.utils import get_all +from tatuclient.v1.cli import common +from tatuclient.v1.utils import get_all LOG = logging.getLogger(__name__) @@ -43,7 +43,7 @@ def _has_project_id(data): return False -class ListRecordSetsCommand(command.Lister): +class ListCACommand(command.Lister): """List recordsets""" columns = ['id', 'name', 'type', 'records', 'status', 'action'] @@ -72,7 +72,7 @@ class ListRecordSetsCommand(command.Lister): return parser def take_action(self, parsed_args): - client = self.app.client_manager.dns + client = self.app.client_manager.ssh common.set_all_common_headers(client, parsed_args) criterion = {} @@ -130,7 +130,7 @@ class ShowRecordSetCommand(command.ShowOne): return parser def take_action(self, parsed_args): - client = self.app.client_manager.dns + client = self.app.client_manager.ssh common.set_all_common_headers(client, parsed_args) data = client.recordsets.get(parsed_args.zone_id, parsed_args.id) @@ -166,7 +166,7 @@ class CreateRecordSetCommand(command.ShowOne): return parser def take_action(self, parsed_args): - client = self.app.client_manager.dns + client = self.app.client_manager.ssh common.set_all_common_headers(client, parsed_args) all_records = parsed_args.record or parsed_args.records @@ -223,7 +223,7 @@ class SetRecordSetCommand(command.ShowOne): if parsed_args.records: data['records'] = parsed_args.records - client = self.app.client_manager.dns + client = self.app.client_manager.ssh common.set_all_common_headers(client, parsed_args) updated = client.recordsets.update( @@ -250,7 +250,7 @@ class DeleteRecordSetCommand(command.ShowOne): return parser def take_action(self, parsed_args): - client = self.app.client_manager.dns + client = self.app.client_manager.ssh common.set_all_common_headers(client, parsed_args) data = client.recordsets.delete(parsed_args.zone_id, parsed_args.id) diff --git a/tatuclient/v2/cli/common.py b/tatuclient/v1/cli/common.py similarity index 77% rename from tatuclient/v2/cli/common.py rename to tatuclient/v1/cli/common.py index ca66754..80fefc5 100644 --- a/tatuclient/v2/cli/common.py +++ b/tatuclient/v1/cli/common.py @@ -24,15 +24,6 @@ def add_all_projects_option(parser): ) -def add_edit_managed_option(parser): - parser.add_argument( - '--edit-managed', - default=False, - action='store_true', - help='Edit resources marked as managed. Default: False' - ) - - def add_sudo_project_id_option(parser): parser.add_argument( '--sudo-project-id', @@ -43,7 +34,6 @@ def add_sudo_project_id_option(parser): def add_all_common_options(parser): add_all_projects_option(parser) - add_edit_managed_option(parser) add_sudo_project_id_option(parser) @@ -55,20 +45,12 @@ def set_sudo_project_id(client, value): client.session.sudo_project_id = value -def set_edit_managed(client, value): - client.session.edit_managed = value - - def set_all_common_headers(client, parsed_args): if parsed_args.all_projects is not None and \ isinstance(parsed_args.all_projects, bool): set_all_projects(client, parsed_args.all_projects) - if parsed_args.edit_managed is not None and \ - isinstance(parsed_args.edit_managed, bool): - set_edit_managed(client, parsed_args.edit_managed) - if parsed_args.sudo_project_id is not None and \ isinstance(parsed_args.sudo_project_id, str): set_sudo_project_id(client, parsed_args.sudo_project_id) diff --git a/tatuclient/v2/cli/hostcert.py b/tatuclient/v1/cli/hostcert.py similarity index 96% rename from tatuclient/v2/cli/hostcert.py rename to tatuclient/v1/cli/hostcert.py index 3926556..5813314 100644 --- a/tatuclient/v2/cli/hostcert.py +++ b/tatuclient/v1/cli/hostcert.py @@ -21,8 +21,8 @@ from osc_lib.command import command import six from tatuclient import utils -from tatuclient.v2.cli import common -from tatuclient.v2.utils import get_all +from tatuclient.v1.cli import common +from tatuclient.v1.utils import get_all LOG = logging.getLogger(__name__) @@ -72,7 +72,7 @@ class ListRecordSetsCommand(command.Lister): return parser def take_action(self, parsed_args): - client = self.app.client_manager.dns + client = self.app.client_manager.ssh common.set_all_common_headers(client, parsed_args) criterion = {} @@ -130,7 +130,7 @@ class ShowRecordSetCommand(command.ShowOne): return parser def take_action(self, parsed_args): - client = self.app.client_manager.dns + client = self.app.client_manager.ssh common.set_all_common_headers(client, parsed_args) data = client.recordsets.get(parsed_args.zone_id, parsed_args.id) @@ -166,7 +166,7 @@ class CreateRecordSetCommand(command.ShowOne): return parser def take_action(self, parsed_args): - client = self.app.client_manager.dns + client = self.app.client_manager.ssh common.set_all_common_headers(client, parsed_args) all_records = parsed_args.record or parsed_args.records @@ -223,7 +223,7 @@ class SetRecordSetCommand(command.ShowOne): if parsed_args.records: data['records'] = parsed_args.records - client = self.app.client_manager.dns + client = self.app.client_manager.ssh common.set_all_common_headers(client, parsed_args) updated = client.recordsets.update( @@ -250,7 +250,7 @@ class DeleteRecordSetCommand(command.ShowOne): return parser def take_action(self, parsed_args): - client = self.app.client_manager.dns + client = self.app.client_manager.ssh common.set_all_common_headers(client, parsed_args) data = client.recordsets.delete(parsed_args.zone_id, parsed_args.id) diff --git a/tatuclient/v2/cli/usercert.py b/tatuclient/v1/cli/usercert.py similarity index 96% rename from tatuclient/v2/cli/usercert.py rename to tatuclient/v1/cli/usercert.py index 3926556..5813314 100644 --- a/tatuclient/v2/cli/usercert.py +++ b/tatuclient/v1/cli/usercert.py @@ -21,8 +21,8 @@ from osc_lib.command import command import six from tatuclient import utils -from tatuclient.v2.cli import common -from tatuclient.v2.utils import get_all +from tatuclient.v1.cli import common +from tatuclient.v1.utils import get_all LOG = logging.getLogger(__name__) @@ -72,7 +72,7 @@ class ListRecordSetsCommand(command.Lister): return parser def take_action(self, parsed_args): - client = self.app.client_manager.dns + client = self.app.client_manager.ssh common.set_all_common_headers(client, parsed_args) criterion = {} @@ -130,7 +130,7 @@ class ShowRecordSetCommand(command.ShowOne): return parser def take_action(self, parsed_args): - client = self.app.client_manager.dns + client = self.app.client_manager.ssh common.set_all_common_headers(client, parsed_args) data = client.recordsets.get(parsed_args.zone_id, parsed_args.id) @@ -166,7 +166,7 @@ class CreateRecordSetCommand(command.ShowOne): return parser def take_action(self, parsed_args): - client = self.app.client_manager.dns + client = self.app.client_manager.ssh common.set_all_common_headers(client, parsed_args) all_records = parsed_args.record or parsed_args.records @@ -223,7 +223,7 @@ class SetRecordSetCommand(command.ShowOne): if parsed_args.records: data['records'] = parsed_args.records - client = self.app.client_manager.dns + client = self.app.client_manager.ssh common.set_all_common_headers(client, parsed_args) updated = client.recordsets.update( @@ -250,7 +250,7 @@ class DeleteRecordSetCommand(command.ShowOne): return parser def take_action(self, parsed_args): - client = self.app.client_manager.dns + client = self.app.client_manager.ssh common.set_all_common_headers(client, parsed_args) data = client.recordsets.delete(parsed_args.zone_id, parsed_args.id) diff --git a/tatuclient/v2/client.py b/tatuclient/v1/client.py similarity index 95% rename from tatuclient/v2/client.py rename to tatuclient/v1/client.py index 7a79409..8a0963c 100644 --- a/tatuclient/v2/client.py +++ b/tatuclient/v1/client.py @@ -16,9 +16,9 @@ from keystoneauth1 import adapter from tatuclient import exceptions -from tatuclient.v2.ca import CAController -from tatuclient.v2.hostcert import HostCeretController -from tatuclient.v2.usercert import UserCeretController +from tatuclient.v1.ca import CAController +from tatuclient.v1.hostcert import HostCeretController +from tatuclient.v1.usercert import UserCeretController from tatuclient import version @@ -101,7 +101,7 @@ class Client(object): service_type=service_type, interface=endpoint_type.rstrip('URL'), user_agent='python-tatuclient-%s' % version.version_info, - version=('2'), + version=('1'), endpoint_override=endpoint_override, timeout=timeout, all_projects=all_projects, diff --git a/tatuclient/v2/hostcert.py b/tatuclient/v1/hostcert.py similarity index 83% rename from tatuclient/v2/hostcert.py rename to tatuclient/v1/hostcert.py index 2d3fd18..11e72ea 100644 --- a/tatuclient/v2/hostcert.py +++ b/tatuclient/v1/hostcert.py @@ -16,11 +16,11 @@ from oslo_utils import uuidutils import six -from tatuclient.v2.base import V2Controller -from tatuclient.v2 import utils as v2_utils +from tatuclient.v1.base import V1Controller +from tatuclient.v1 import utils as v1_utils -class RecordSetController(V2Controller): +class RecordSetController(V1Controller): def _canonicalize_record_name(self, zone, name): zone_info = None @@ -66,7 +66,7 @@ class RecordSetController(V2Controller): return self._post(url, data=data) def list(self, zone, criterion=None, marker=None, limit=None): - zone = v2_utils.resolve_by_name(self.client.zones.list, zone) + zone = v1_utils.resolve_by_name(self.client.zones.list, zone) url = self.build_url( '/zones/%s/recordsets' % zone, @@ -81,8 +81,8 @@ class RecordSetController(V2Controller): return self._get(url, response_key='recordsets') def get(self, zone, recordset): - zone = v2_utils.resolve_by_name(self.client.zones.list, zone) - recordset = v2_utils.resolve_by_name(self.list, recordset, zone) + zone = v1_utils.resolve_by_name(self.client.zones.list, zone) + recordset = v1_utils.resolve_by_name(self.list, recordset, zone) url = self.build_url('/zones/%s/recordsets/%s' % ( zone, recordset)) @@ -90,16 +90,16 @@ class RecordSetController(V2Controller): return self._get(url) def update(self, zone, recordset, values): - zone = v2_utils.resolve_by_name(self.client.zones.list, zone) - recordset = v2_utils.resolve_by_name(self.list, recordset, zone) + zone = v1_utils.resolve_by_name(self.client.zones.list, zone) + recordset = v1_utils.resolve_by_name(self.list, recordset, zone) url = '/zones/%s/recordsets/%s' % (zone, recordset) return self._put(url, data=values) def delete(self, zone, recordset): - zone = v2_utils.resolve_by_name(self.client.zones.list, zone) - recordset = v2_utils.resolve_by_name(self.list, recordset, zone) + zone = v1_utils.resolve_by_name(self.client.zones.list, zone) + recordset = v1_utils.resolve_by_name(self.list, recordset, zone) url = '/zones/%s/recordsets/%s' % (zone, recordset) diff --git a/tatuclient/v2/usercert.py b/tatuclient/v1/usercert.py similarity index 83% rename from tatuclient/v2/usercert.py rename to tatuclient/v1/usercert.py index 2d3fd18..11e72ea 100644 --- a/tatuclient/v2/usercert.py +++ b/tatuclient/v1/usercert.py @@ -16,11 +16,11 @@ from oslo_utils import uuidutils import six -from tatuclient.v2.base import V2Controller -from tatuclient.v2 import utils as v2_utils +from tatuclient.v1.base import V1Controller +from tatuclient.v1 import utils as v1_utils -class RecordSetController(V2Controller): +class RecordSetController(V1Controller): def _canonicalize_record_name(self, zone, name): zone_info = None @@ -66,7 +66,7 @@ class RecordSetController(V2Controller): return self._post(url, data=data) def list(self, zone, criterion=None, marker=None, limit=None): - zone = v2_utils.resolve_by_name(self.client.zones.list, zone) + zone = v1_utils.resolve_by_name(self.client.zones.list, zone) url = self.build_url( '/zones/%s/recordsets' % zone, @@ -81,8 +81,8 @@ class RecordSetController(V2Controller): return self._get(url, response_key='recordsets') def get(self, zone, recordset): - zone = v2_utils.resolve_by_name(self.client.zones.list, zone) - recordset = v2_utils.resolve_by_name(self.list, recordset, zone) + zone = v1_utils.resolve_by_name(self.client.zones.list, zone) + recordset = v1_utils.resolve_by_name(self.list, recordset, zone) url = self.build_url('/zones/%s/recordsets/%s' % ( zone, recordset)) @@ -90,16 +90,16 @@ class RecordSetController(V2Controller): return self._get(url) def update(self, zone, recordset, values): - zone = v2_utils.resolve_by_name(self.client.zones.list, zone) - recordset = v2_utils.resolve_by_name(self.list, recordset, zone) + zone = v1_utils.resolve_by_name(self.client.zones.list, zone) + recordset = v1_utils.resolve_by_name(self.list, recordset, zone) url = '/zones/%s/recordsets/%s' % (zone, recordset) return self._put(url, data=values) def delete(self, zone, recordset): - zone = v2_utils.resolve_by_name(self.client.zones.list, zone) - recordset = v2_utils.resolve_by_name(self.list, recordset, zone) + zone = v1_utils.resolve_by_name(self.client.zones.list, zone) + recordset = v1_utils.resolve_by_name(self.list, recordset, zone) url = '/zones/%s/recordsets/%s' % (zone, recordset) diff --git a/tatuclient/v2/utils.py b/tatuclient/v1/utils.py similarity index 98% rename from tatuclient/v2/utils.py rename to tatuclient/v1/utils.py index 63f92b8..6da297f 100644 --- a/tatuclient/v2/utils.py +++ b/tatuclient/v1/utils.py @@ -60,7 +60,7 @@ def get_all(function, criterion=None, args=None): :param function: Function to be called to get data :param criterion: dict of filters to be applied :param args: arguments to be given to the function - :return: DesignateList() + :return: TatuList() """ criterion = criterion or {} diff --git a/tox.ini b/tox.ini index 0fa1b2e..7314702 100644 --- a/tox.ini +++ b/tox.ini @@ -49,7 +49,7 @@ commands = {posargs} [testenv:functional] usedevelop = False setenv = {[testenv]setenv} - OS_TEST_PATH=designateclient/functionaltests/ + OS_TEST_PATH=tatuclient/functionaltests/ passenv = OS_STDOUT_CAPTURE OS_STDERR_CAPTURE OS_LOG_CAPTURE @@ -66,7 +66,7 @@ commands = sphinx-build -a -E -d releasenotes/build/doctrees -b html releasenote # H404 multi line docstring should start with a summary # H405 multi line docstring summary not separated with an empty line # H904 Wrap long lines in parentheses instead of a backslash -# See designate for other ignored codes that may apply here +# See tatu for other ignored codes that may apply here ignore = H105, H302,H402,H404,H405,H904 builtins = _