Commit Graph

357 Commits

Author SHA1 Message Date
Clark Boylan d004b1a73a Fix coverage reporting test.
A change was committed that modified the
glanceclient.common.__init__.py file that seems to conflict with the
NOSE_WITH_COVERAGE environment variable. Run the coverage tests like
novaclient and swiftclient to get around this problem.

Change-Id: Id9a655a0207d3b16a619972ebaecc87387cf784e
2012-07-27 14:39:58 -07:00
Sascha Peilicke bb282936a0 Honor '--insecure' commandline flag also for keystone authentication
Currently, keystone auth fails with self-signed certificates.

Change-Id: Ice89bcd0662038260bc4bd12058972bb35e61e3b
2012-07-26 15:48:23 +02:00
Brian Waldon 1e744f162e Replace httplib2 with httplib as http driver
* This allows us to send truly chunked responses to users
* Handle bad connection url schemes with a new InvalidEndpoint exception
* Fixes bug 1023240

Change-Id: I34500987f51d4e0c6e1f89ecf93853de3fcbb1c3
2012-07-23 13:52:12 -07:00
Sascha Peilicke 71a0caece8 Clarify usage of --insecure flag
Change-Id: If19a7aab92350fb68e447a0ffe8a97e079d762e4
2012-07-20 10:18:23 +02:00
Jenkins 070f176abf Merge "Relax prettytable dependency to v0.6.X from v0.6" 2012-07-19 21:26:04 +00:00
Brian Waldon 0f628b19cb Add pagination to v1 image-list
* Use recursive generator function to make subsequent requests
  to the v1 detailed images resource
* 'limit' continues to act as the absolute limit of images to return
  from a list call
* 'page_size' indicates how many images to ask for in each subsequent
  pagination request
* Expose --page-size through the cli
* Convert v1 images tests to use strict url comparison
* Drop strict_url_check from FakeAPI kwargs - now the functionality
  is always active and tests must directly match fixture urls
* Fix bug 1024614

Change-Id: Ifa7874d88360e03b5c8aa95bfb9d5e6dc6dc927e
2012-07-19 13:26:37 -07:00
Jenkins 570e64d91f Merge "Wrap image data in iterator" 2012-07-19 20:19:30 +00:00
Jenkins 5f380c1f91 Merge changes Ib98e912a,Ib98e912a
* changes:
  Add pagination to v2 image-list
  Prevent links from being printed in v2 CLI
2012-07-18 01:56:22 +00:00
Jenkins a8a3f4d67b Merge changes Ib98e912a,Ib98e912a,Ib98e912a,Ib98e912a,Ib98e912a
* changes:
  Align print_dict to the left
  Convert v2 images list method to generator
  Replace static v2 Image model with warlock model
  Add support for viewing a single image through v2
  Rewrite link parsing for finding v2 schemas
2012-07-18 01:02:07 +00:00
Brian Waldon 6206f42028 Update README usage examples
* Update the python snippet to reflect reality
* Fix broken links
* Remove superfluous text

Change-Id: I4b7e9aae35cc49e5fa89ca33d2399784c2afd029
2012-07-17 16:52:03 -07:00
Brian Waldon c201f24d5a Relax prettytable dependency to v0.6.X from v0.6
Change-Id: Ide7247ba444b60179d9c76c43dfaa43c025b69c9
2012-07-17 15:29:57 -07:00
Brian Waldon d88d8fc462 Add pagination to v2 image-list
* Use a recursive generator function to iterate over the image
  container. The presence of next links are indicators to
  continue pagination while their value drives the location of
  the next page.
* A user can pass in --page-size on the command line, or page_size
  when using the controller directly, to control how many images
  are requested with each subsequent paginated request. Default page
  size is 20.
* Add a flag (strict_url_check) for the FakeAPI class to control
  whether it chops off query params when trying to match a request
  to a fixture.
* Related to bp glance-client-v2.

Change-Id: Ib98e912a7af0bb570b4fd738733edd9b837d1a12
2012-07-13 20:12:06 -07:00
Brian Waldon 95a7f9dffe Prevent links from being printed in v2 CLI
Nobody wants to see links in a human interface. This prevents the
file, access, self and schema links from being printed when calling
image-show or explain.

Related to bp glance-client-v2

Change-Id: Ib98e912a7af0bb570b4fd738733edd9b837d1a11
2012-07-13 20:12:00 -07:00
Brian Waldon 8bf9e11244 Align print_dict to the left
Change-Id: Ib98e912a7af0bb570b4fd738733edd9b837d1a10
2012-07-13 20:11:52 -07:00
Brian Waldon e5f038b62a Convert v2 images list method to generator
We will want this to be a generator as soon as we implement
pagination. Let's establish the interface now.

Related to bp glance-client-v2

Change-Id: Ib98e912a7af0bb570b4fd738733edd9b837d1a07
2012-07-13 18:38:41 -07:00
Brian Waldon c398af18b0 Replace static v2 Image model with warlock model
* Add warlock v0.1.0 as a dependency
* Generate a pythonic, self-validating Image model using warlock
* Add raw method to Schema model
* Related to bp glance-client-v2

Change-Id: Ib98e912a7af0bb570b4fd738733edd9b837d1a04
2012-07-13 18:38:41 -07:00
Brian Waldon b6cef9d145 Add support for viewing a single image through v2
* Add image-create command
* Add tests for Image model, Controller.get, and Controller.list
* Related to bp glance-client-v2

Change-Id: Ib98e912a7af0bb570b4fd738733edd9b837d1a06
2012-07-13 18:38:40 -07:00
Brian Waldon f0445a1b44 Rewrite link parsing for finding v2 schemas
What we called 'links' are no longer returned in a container of
objects, they are top-level entity attribtues. This fixes the
parsing of the entities to look in the correct place when trying
to locate a specific schema.

Add a helper for printing to stderr and exiting with a non-zero
exit code.

Map 'name' to 'Attribute' when explaining a schema.

Related to bp glance-client-v2

Change-Id: Ib98e912a7af0bb570b4fd738733edd9b837d1a05
2012-07-13 18:38:40 -07:00
Brian Waldon 53acf1a0ca Establish the supported importable interface
* Consumers of this client should not depend on being able to import
  any module other than glanceclient and glanceclient
* The only attributs of the glanceclient module are Client
  and __version__
* The attributes of the glanceclient.exc modules have yet to be
  locked down
* glanceclient.common.exceptions was replaced with a placeholder
  module until consumers of it are updated

Change-Id: Iea9648cd06906d65764987c1f2ee5a88ebeee748
2012-07-13 18:38:15 -07:00
Brian Waldon 49bc6f94f2 Add --is-public to image-create
This moves image-create closer to image-update by adding
--is-public and hiding the help output of --public. The
--public option will be removed once devstack no longer
depends on it.

Fix bug 1023632

Change-Id: I2c58655ba56eef1fa486246618c4fb5bd3c6c8cf
2012-07-13 08:12:45 -07:00
Jenkins c097432828 Merge "Translate is_protected to protected" 2012-07-12 22:55:10 +00:00
Jenkins 1a8ab3c3f2 Merge changes I02ddeb59,Ife231377
* changes:
  Change --protected to --is-protected in create
  Properly map boolean-like arguments to True/False
2012-07-12 22:55:02 +00:00
Jenkins 4e9bac2d0a Merge "Remove AuthorizationFailure exception" 2012-07-12 19:42:38 +00:00
Brian Waldon da360462a5 Wrap image data in iterator
This is establishing the API for a future optimization. We want to
be able to offer true socket-level caching, but can't do that with
httplib2 right now. For now, we will just fake the optimization
by returning an iterator over the image body, which happens to already
be fully loaded into a string.

Change-Id: I2d36e3cdd45b26d7c7c27ba050bf6a4b5765df6c
2012-07-11 19:55:02 -07:00
Brian Waldon b7f476e211 Translate is_protected to protected
When creating or updating an image, translate the 'is_protected'
argument into the proper 'protected' image attribute.

Fix bug 1023653

Change-Id: Icfe6c38e4fda098ce3f90fd94c8fbbc18be2f4a8
2012-07-11 16:37:28 -07:00
Brian Waldon d8433ee40a Change --protected to --is-protected in create
Make image-create match image-update when specifying a specific
value for 'protected'.

Fix bug 1023650

Change-Id: I02ddeb59c1f6882b206279a71f7af8889ce4602c
2012-07-11 16:28:24 -07:00
Brian Waldon db1fabed11 Properly map boolean-like arguments to True/False
--is-public and --is-protected are now evaluated as True and False

Fix bug 1023652

Change-Id: Ife2313770eebc176e7744711956aed20f16576a5
2012-07-11 16:25:13 -07:00
Monty Taylor a814c15465 Add ability to get version information in python
* A user can access glanceclient.__version__ to get a string
  representing the version of the installed library.
* Add openstack-common's 'version' module.

Change-Id: Ib14c561d8ac0b126617a20acfbd5fdb61c54f2c7
2012-07-11 14:04:09 -07:00
Monty Taylor c315c5274f Latest setup goodness.
Upgrade the common setup code to the latest versions, and use setuptools-git
for sdist tarball generation.

Change-Id: I81eca9199b7d330ef8ec80482565a75f8475a78c
2012-07-11 12:21:29 -05:00
Brian Waldon d2ab65255f Remove AuthorizationFailure exception
The AuthorizationFailure exception isn't used anywhere, so
remove it.

Fix bug 1015940.

Change-Id: Ie6da74b63e3d1658c8ae26c272222f00f1209e38
2012-07-10 21:10:40 -07:00
Brian Waldon cf8613e76d Preserve image properties on update
* By default, image properties should not be deleted on image update.
* A user can specify --purge-props through the CLI or purge_props
  as a keyword argument to ImageManager.update to override the default
  behavior and force properties to be deleted.
* Fixes bug 1022758

Change-Id: Ib079378cb765552fc29a66913aefbbcd934d2065
2012-07-09 21:03:46 -07:00
Brian Waldon 0e8ab72357 Add --file to image-update and correct bad name
* Add the --file option to the image-update action, as it was left out
  of a previous patch
* Additionally, change a bad reference (args.fields) to args.file
* Fix bug 1022750

Change-Id: Idde127ec3f138f718d671b2133d50debec26236e
2012-07-09 15:25:10 -07:00
Jenkins 88a039488b Merge "Allow image filtering by custom properties" 2012-07-09 17:42:13 +00:00
Jenkins 7a2b39727b Merge "Expand v1 image-list filters" 2012-07-09 17:42:11 +00:00
Jenkins 12c51bbcad Merge "Add --timeout option to cli" 2012-07-09 17:42:10 +00:00
Jenkins ce806d615b Merge "Add size filtering to image-list action" 2012-07-09 17:34:41 +00:00
Jenkins cc9e28a4c1 Merge "Use PyPI for keystoneclient." 2012-07-05 20:56:15 +00:00
Brian Waldon a1691ddc10 Allow image filtering by custom properties
A user can filter a list of images by passing in a 'properties'
sub-dictionary inside of the 'filters' keyword argumen to
ImageManager.list(). The same functionality can be used through
the CLI through the use of one or more'--property-filter' options.

Related to bp glance-client-parity.

Change-Id: I7d119174d83faa894dde557e1944289de296a02c
2012-07-04 15:49:41 -07:00
Brian Waldon e7db533bc0 Expand v1 image-list filters
Add comparison filters for the v1 image-list command: --name,
--status, --container-format, --disk-format.

Related to bp glance-client-parity.

Change-Id: I27377764ea5543a4bef593f0a731b09a914a9265
2012-07-04 15:24:08 -07:00
Brian Waldon b05a9c0200 Add --timeout option to cli
Create a --timeout option to allow users to provide a custom timeout
for requests from the command line. The timeout functonality already
exists in both v1 and v2 client classes.

Related to bp glance-client-parity

Change-Id: Ic91de5eae2824b37f6aad3adc5fda28b9674250e
2012-07-04 14:52:33 -07:00
Brian Waldon 9aad246f0e Add size filtering to image-list action
Add --size-min and --size-max options to image-list to
represent the size_min and size_max filters passed to
the ImageManager.list method.

Related to bp glance-client-parity

Change-Id: Icb5458c3ed26ea754cff6360b741b3af99d1beb5
2012-07-04 14:24:38 -07:00
Adam Gandelman 2713ca1bdc Allow image upload from local file to v1 API
Allow an image to be read from a local file as an alternative to
stdin (which remains the default).

Change-Id: I81070ded9c505df7924c4efd5ae54cf3c0fa534d
2012-07-03 10:52:37 -07:00
Monty Taylor ac7121fc0e Use PyPI for keystoneclient.
Change-Id: Ib1ce43cde3e6848a873778dd9fc6aa4709df6452
2012-07-02 18:24:05 -04:00
Dan Prince e9b8f8ec2f Switch CLI to support underscores and dashes.
Update the glanceclient CLI to support both underscores and dashes.

Dashes are prefered and show up in help.

This will hopefully keep the CLI more consistent with the other
OpenStack client projects like Nova, Swift, Keystone in addition to the
old Glance client which all seem to prefer underscores to dashes.

Fixes LP Bug #1018467.

Change-Id: I80d7a19f94033554f7f639166911726de4a5159f
2012-06-29 16:47:18 -04:00
Monty Taylor 089d509f35 Split reading of versioninfo out into a method
Make the read_versioninfo to match write_versioninfo.

Additionally, there is an edge case where if the code is installed from a
github zipball, versioning info is missing. Now that we're using this,
there should be virtual no instances where a zipball will be easier or
less cost than an sdist created tarball, all of which should be public and
accessible, but during the transition, we need to account for the codepath.

Change-Id: Icd3fe97c6341bb04da27adc55a85f1ab6b525c46
2012-06-26 14:05:36 -05:00
Jenkins 993a7b7dd6 Merge "Add support for tag-based version numbers." 2012-06-26 16:58:08 +00:00
Monty Taylor 03efd16896 Add support for tag-based version numbers.
Change-Id: I9b0e24f65e9b79c39bdf279b7af9c1040ded7952
2012-06-25 10:09:44 -05:00
Bhuvan Arumugam d6e0a03a93 Support --os-endpoint-type in glanceclient.
Bug: 993993

* glanceclient/shellp.py
  OpenStackImagesShell.get_base_parser(): Parse --os-endpoint-type
  argument. Default to one defined in os.environ.
  OpenStackImagesShell._authenticate(): Define endpoint type based
  on command line argument. Use 'publicURL', if it's not specified
  in command line and also not defined in os.environ.
  OpenStackImagesShell.main(): Pass this value to authenticate.

Change-Id: I0c0cde5212198eec2a7d75fb2a7cad1cde048c7c
2012-06-23 22:28:21 -07:00
Brian Waldon 99e872a57b Hook up GET /v1/images/<id>
This allows us to get raw image data out of the API! Related to
bp glance-client-parity

Change-Id: Id5f55553d2ff3b7bf58515062afdfd4b9b183a54
2012-06-21 13:06:18 -07:00
Monty Taylor 6e1157059e Add initial docs.
Change-Id: I1f8407597105a914945c932ff55945c8005e273c
2012-06-14 14:24:05 -04:00