Permalink
Browse files

The MASSIVE RENAME: cloudservers is now openstack.compute.

This doesn't add support for other OpenStack endpoints *yet*; it's just the
massive rename.
  • Loading branch information...
1 parent 42da6c7 commit c2e297d3c9b5b1037540cbe54b347fc8f2ffe4ea @jacobian jacobian committed Mar 16, 2011
View
@@ -0,0 +1,8 @@
+#
+# pip requires for hacking on the code.
+#
+
+mock
+nose
+coverage
+Sphinx
View
@@ -1,22 +1,22 @@
-The :mod:`cloudservers` Python API
-==================================
+The :mod:`openstack.compute` Python API
+=======================================
-.. module:: cloudservers
- :synopsis: A client for the Rackspace Cloud Servers API.
+.. module:: openstack.compute
+ :synopsis: A client for the OpenStack Compute API.
-.. currentmodule:: cloudservers
+.. currentmodule:: openstack.compute
Usage
-----
-First create an instance of :class:`CloudServers` with your credentials::
+First create an instance of :class:`Compute` with your credentials::
- >>> from cloudservers import CloudServers
- >>> cloudservers = CloudServers(USERNAME, API_KEY)
+ >>> from openstack.compute import Compute
+ >>> compute = Compute(USERNAME, API_KEY)
@rlr

rlr Mar 18, 2011

Contributor

I tripped up on this, __init__ only takes kwargs so it should probably be:
>>> compute = Compute(username=USERNAME, apikey=API_KEY)

-Then call methods on the :class:`CloudServers` object:
+Then call methods on the :class:`Compute` object:
-.. class:: CloudServers
+.. class:: Compute
.. attribute:: backup_schedules
@@ -43,10 +43,10 @@ Then call methods on the :class:`CloudServers` object:
For example::
- >>> cloudservers.servers.list()
+ >>> compute.servers.list()
[<Server: buildslave-ubuntu-9.10>]
- >>> cloudservers.flavors.list()
+ >>> compute.flavors.list()
[<Flavor: 256 server>,
<Flavor: 512 server>,
<Flavor: 1GB server>,
@@ -55,7 +55,7 @@ For example::
<Flavor: 8GB server>,
<Flavor: 15.5GB server>]
- >>> fl = cloudservers.flavors.find(ram=512)
+ >>> fl = compute.flavors.find(ram=512)
>>> cloudservers.servers.create("my-server", flavor=fl)
@rlr

rlr Mar 18, 2011

Contributor

s/cloudservers/compute/

... and missing image?

<Server: my-server>
View
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
-# python-cloudservers documentation build configuration file, created by
+# openstack.computedoc documentation build configuration file, created by
# sphinx-quickstart on Sun Dec 6 14:19:25 2009.
#
# This file is execfile()d with the current directory set to its containing dir.
@@ -37,7 +37,7 @@
master_doc = 'index'
# General information about the project.
-project = u'python-cloudservers'
+project = u'openstack.compute'
copyright = u'Jacob Kaplan-Moss'
# The version info for the project you're documenting, acts as replacement for
@@ -91,7 +91,7 @@
# The theme to use for HTML and HTML Help pages. Major themes that come with
# Sphinx are currently 'default' and 'sphinxdoc'.
-html_theme = 'nature'
+# html_theme = 'default'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
@@ -158,7 +158,7 @@
#html_file_suffix = ''
# Output file base name for HTML help builder.
-htmlhelp_basename = 'python-cloudserversdoc'
+htmlhelp_basename = 'openstack.computedoc'
# -- Options for LaTeX output --------------------------------------------------
@@ -172,7 +172,7 @@
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
- ('index', 'python-cloudservers.tex', u'python-cloudservers Documentation',
+ ('index', 'openstack.compute.tex', u'openstack.compute Documentation',
u'Jacob Kaplan-Moss', 'manual'),
]
View
@@ -1,25 +1,27 @@
-Python bindings to the Rackspace Cloud Servers API
-==================================================
-
-This is a client for Rackspace's Cloud Servers API. There's :doc:`a Python API
-<api>` (the :mod:`cloudservers` module), and a :doc:`command-line script
-<shell>` (installed as :program:`cloudservers`). Each implements the entire
-Rackspace Cloud Servers API.
-
-You'll need a `Rackspace Cloud`__ account, and you'll need to make sure to sign
-up for both Cloud Servers *and* Cloud Files -- Rackspace won't let you get an
-API key unless you've got a Cloud Files account, too. Once you've got an
-account, you'll find your API key in the management console under "Your
-Account".
+Python bindings to the OpenStack Compute API
+============================================
+
+This is a client for Rackspace's OpenStack Compute API used by Rackspace Cloud
+and others.. There's :doc:`a Python API <api>` (the :mod:`openstack.compute`
+module), and a :doc:`command-line script <shell>` (installed as
+:program:`openstack-compute`). Each implements the entire OpenStack Compute
+API (as well as a few Rackspace-only addons).
+
+To try this out, you'll need a `Rackspace Cloud`__ account — or your own
+install of OpenStack Compute (also known as Nova). If you're using Rackspace
+you'll need to make sure to sign up for both Cloud Servers *and* Cloud Files
+-- Rackspace won't let you get an API key unless you've got a Cloud Files
+account, too. Once you've got an account, you'll find your API key in the
+management console under "Your Account".
__ http://rackspacecloud.com/
.. seealso::
You may want to read `Rackspace's API guide`__ (PDF) -- the first bit, at
- least -- to get an idea of the concepts. Rackspace is doing the cloud
- hosting thing a bit differently from Amazon, and if you get the concepts
- this library should make more sense.
+ least -- to get an idea of the concepts. Rackspace/OpenStack is doing the
+ cloud hosting thing a bit differently from Amazon, and if you get the
+ concepts this library should make more sense.
__ http://docs.rackspacecloud.com/servers/api/cs-devguide-latest.pdf
@@ -38,7 +40,7 @@ Contributing
Development takes place `on GitHub`__; please file bugs/pull requests there.
-__ http://github.com/jacobian/python-cloudservers
+__ http://github.com/jacobian/openstack.compute
Run tests with ``python setup.py test``.
@@ -1,7 +1,7 @@
Backup schedules
================
-.. currentmodule:: cloudservers
+.. currentmodule:: openstack.compute
Rackspace allows scheduling of weekly and/or daily backups for virtual
servers. You can access these backup schedules either off the API object as
View
@@ -1,14 +1,14 @@
Exceptions
==========
-.. currentmodule:: cloudservers
+.. currentmodule:: openstack.compute
Exceptions
----------
Exceptions that the API might throw:
-.. automodule:: cloudservers
- :members: CloudServersException, BadRequest, Unauthorized, Forbidden,
+.. automodule:: openstack.compute
+ :members: ComputeException, BadRequest, Unauthorized, Forbidden,
NotFound, OverLimit
View
@@ -10,7 +10,7 @@ From Rackspace's API documentation:
Classes
-------
-.. currentmodule:: cloudservers
+.. currentmodule:: openstack.compute
.. autoclass:: FlavorManager
:members: get, list, find, findall
View
@@ -1,7 +1,7 @@
Images
======
-.. currentmodule:: cloudservers
+.. currentmodule:: openstack.compute
An "image" is a snapshot from which you can create new server instances.
View
@@ -25,7 +25,7 @@ From the Rackspace API guide:
Classes
-------
-.. currentmodule:: cloudservers
+.. currentmodule:: openstack.compute
.. autoclass:: IPGroupManager
:members: get, list, find, findall, create, delete
View
@@ -6,7 +6,7 @@ A virtual machine instance.
Classes
-------
-.. currentmodule:: cloudservers
+.. currentmodule:: openstack.compute
.. autoclass:: ServerManager
:members: get, list, find, findall, create, update, delete, share_ip,
View
@@ -2,6 +2,23 @@
Release notes
=============
+2.0 (TBD)
+=========
+
+* **Major renaming**: the library is now called ``openstack.compute`` to
+ reflect that Rackspace Cloud is just one instance of the open source
+ project. This ripples to a lot of places:
+
+ * The library is now called ``openstack.compute`` instead of
+ ``cloudservers``, and the main API entry point is now
+ ``openstack.compute.Compute`` instead of ``cloudservers.CloudServers``.
+
+ * The shell program is now ``openstack-compute`` instead of
+ ``cloudservers``. Yes, the name's a lot longer. Use ``alias``.
+
+ * The env variables are now ``OPENSTACK_COMPUTE_USERNAME`` and
+ ``OPENSTACK_COMPUTE_API_KEY``.
+
1.2 (August 15, 2010)
=====================
View
@@ -1,40 +1,45 @@
-The :program:`cloudservers` shell utility
-=========================================
+The :program:`openstack-compute` shell utility
+==============================================
-.. program:: cloudservers
+.. program:: openstack-compute
.. highlight:: bash
-The :program:`cloudservers` shell utility interacts with Rackspace Cloud servers
-from the command line. It supports the entirety of the Cloud Servers API,
-including some commands not available from the Rackspace web console.
+The :program:`openstack-compute` shell utility interacts with OpenStack
+Compute servers from the command line. It supports the entirety of the
+OpenStack Compute API (plus a few Rackspace-specific additions), including
+some commands not available from the Rackspace web console.
-First, you'll need a Rackspace Cloud Servers account and an API key. At the time
-of this writing getting an API key is non-obvious: you need to sign up for
-*both* Cloud Servers *and* Cloud Files; only then can you grab an API key from
-the Rackspace web console.
+To try this out, you'll need a `Rackspace Cloud`__ account — or your own
+install of OpenStack Compute (also known as Nova). If you're using Rackspace
+you'll need to make sure to sign up for both Cloud Servers *and* Cloud Files
+-- Rackspace won't let you get an API key unless you've got a Cloud Files
+account, too. Once you've got an account, you'll find your API key in the
+management console under "Your Account".
-You'll need to provide :program:`cloudservers` with your Rackspace username and
-API key. You can do this with the :option:`--username` and :option:`--apikey`
-options, but it's easier to just set them as environment variables by setting
-two environment variables:
+__ http://rackspacecloud.com/
-.. envvar:: CLOUD_SERVERS_USERNAME
+You'll need to provide :program:`openstack-compute` with your Rackspace
+username and API key. You can do this with the :option:`--username` and
+:option:`--apikey` options, but it's easier to just set them as environment
+variables by setting two environment variables:
+
+.. envvar:: OPENSTACK_COMPUTE_USERNAME
Your Rackspace Cloud username.
-.. envvar:: CLOUD_SERVERS_API_KEY
+.. envvar:: OPENSTACK_COMPUTE_API_KEY
Your API key.
For example, in Bash you'd use::
- export CLOUD_SERVERS_USERNAME=yourname
- export CLOUD_SERVERS_API_KEY=yadayadayada
+ export COPENSTACK_COMPUTE_USERNAME=yourname
+ export COPENSTACK_COMPUTE_API_KEY=yadayadayada
From there, all shell commands take the form::
- cloudservers <command> [arguments...]
+ openstack-compute <command> [arguments...]
-Run :program:`cloudservers help` to get a full list of all possible commands,
-and run :program:`cloudservers help <command>` to get detailed help for that
-command.
+Run :program:`openstack-compute help` to get a full list of all possible
+commands, and run :program:`openstack-compute help <command>` to get detailed
+help for that command.
View
@@ -0,0 +1,6 @@
+try:
+ import pkg_resources
+ pkg_resources.declare_namespace(__name__)
+except ImportError:
+ import pkgutil
+ __path__ = pkgutil.extend_path(__path__, __name__)
@@ -1,6 +1,6 @@
-__version__ = '1.2'
+__version__ = '2.0'
-from cloudservers.backup_schedules import (BackupSchedule, BackupScheduleManager,
+from openstack.compute.backup_schedules import (BackupSchedule, BackupScheduleManager,
BACKUP_WEEKLY_DISABLED, BACKUP_WEEKLY_SUNDAY, BACKUP_WEEKLY_MONDAY,
BACKUP_WEEKLY_TUESDAY, BACKUP_WEEKLY_WEDNESDAY,
BACKUP_WEEKLY_THURSDAY, BACKUP_WEEKLY_FRIDAY, BACKUP_WEEKLY_SATURDAY,
@@ -11,35 +11,35 @@
BACKUP_DAILY_H_1400_1600, BACKUP_DAILY_H_1600_1800,
BACKUP_DAILY_H_1800_2000, BACKUP_DAILY_H_2000_2200,
BACKUP_DAILY_H_2200_0000)
-from cloudservers.client import CloudServersClient
-from cloudservers.exceptions import (CloudServersException, BadRequest, Unauthorized,
+from openstack.compute.client import ComputeClient
+from openstack.compute.exceptions import (ComputeException, BadRequest, Unauthorized,
Forbidden, NotFound, OverLimit)
-from cloudservers.flavors import FlavorManager, Flavor
-from cloudservers.images import ImageManager, Image
-from cloudservers.ipgroups import IPGroupManager, IPGroup
-from cloudservers.servers import ServerManager, Server, REBOOT_HARD, REBOOT_SOFT
+from openstack.compute.flavors import FlavorManager, Flavor
+from openstack.compute.images import ImageManager, Image
+from openstack.compute.ipgroups import IPGroupManager, IPGroup
+from openstack.compute.servers import ServerManager, Server, REBOOT_HARD, REBOOT_SOFT
-class CloudServers(object):
+class Compute(object):
"""
- Top-level object to access the Rackspace Cloud Servers API.
+ Top-level object to access the OpenStack Compute API.
Create an instance with your creds::
- >>> cs = CloudServers(USERNAME, API_KEY)
+ >>> compute = Compute(USERNAME, API_KEY)
Then call methods on its managers::
- >>> cs.servers.list()
+ >>> compute.servers.list()
...
- >>> cs.flavors.list()
+ >>> compute.flavors.list()
...
&c.
"""
def __init__(self, username, apikey):
self.backup_schedules = BackupScheduleManager(self)
- self.client = CloudServersClient(username, apikey)
+ self.client = ComputeClient(username, apikey)
self.flavors = FlavorManager(self)
self.images = ImageManager(self)
self.ipgroups = IPGroupManager(self)
@@ -52,7 +52,7 @@ def authenticate(self):
Normally this is called automatically when you first access the API,
but you can call this method to force authentication right now.
- Returns on success; raises :exc:`cloudservers.Unauthorized` if the
- credentials are wrong.
+ Returns on success; raises :exc:`~openstack.compute.Unauthorized` if
+ the credentials are wrong.
"""
self.client.authenticate()
@@ -1,4 +1,4 @@
-from cloudservers import base
+from openstack.compute import base
BACKUP_WEEKLY_DISABLED = 'DISABLED'
BACKUP_WEEKLY_SUNDAY = 'SUNDAY'
Oops, something went wrong.

0 comments on commit c2e297d

Please sign in to comment.