~ubuntu-branches/ubuntu/trusty/heat/trusty-security

« back to all changes in this revision

Viewing changes to heat/engine/resources/quantum/net.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short, Yolanda Robla, Chuck Short
  • Date: 2013-07-22 16:22:29 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20130722162229-zzvfu40id94ii0hc
Tags: 2013.2~b2-0ubuntu1
[ Yolanda Robla ]
* debian/tests: added autopkg tests

[ Chuck Short ]
* New upstream release
* debian/control:
  - Add python-pbr to build-depends.
  - Add python-d2to to build-depends.
  - Dropped python-argparse.
  - Add python-six to build-depends.
  - Dropped python-sendfile.
  - Dropped python-nose.
  - Added testrepository.
  - Added python-testtools.
* debian/rules: Run testrepository instead of nosetets.
* debian/patches/removes-lxml-version-limitation-from-pip-requires.patch: Dropped
  no longer needed.
* debian/patches/fix-package-version-detection-when-building-doc.patch: Dropped
  no longer needed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
from heat.engine import clients
17
17
from heat.openstack.common import log as logging
18
18
from heat.engine.resources.quantum import quantum
 
19
from heat.engine import scheduler
 
20
 
 
21
if clients.quantumclient is not None:
 
22
    from quantumclient.common.exceptions import QuantumClientException
19
23
 
20
24
logger = logging.getLogger(__name__)
21
25
 
26
30
                                         'Default': {}},
27
31
                         'admin_state_up': {'Default': True,
28
32
                                            'Type': 'Boolean'}}
29
 
 
30
 
    def __init__(self, name, json_snippet, stack):
31
 
        super(Net, self).__init__(name, json_snippet, stack)
 
33
    attributes_schema = {
 
34
        "id": "the unique identifier for this network",
 
35
        "status": "the status of the network",
 
36
        "name": "the name of the network",
 
37
        "subnets": "subnets of this network",
 
38
        "admin_state_up": "the administrative status of the network",
 
39
        "tenant_id": "the tenant owning this network"
 
40
    }
32
41
 
33
42
    def handle_create(self):
34
43
        props = self.prepare_properties(
37
46
        net = self.quantum().create_network({'network': props})['network']
38
47
        self.resource_id_set(net['id'])
39
48
 
 
49
    def _show_resource(self):
 
50
        return self.quantum().show_network(
 
51
            self.resource_id)['network']
 
52
 
 
53
    def check_create_complete(self, *args):
 
54
        attributes = self._show_resource()
 
55
        return self.is_built(attributes)
 
56
 
40
57
    def handle_delete(self):
41
 
        from quantumclient.common.exceptions import QuantumClientException
42
 
 
43
58
        client = self.quantum()
44
59
        try:
45
60
            client.delete_network(self.resource_id)
46
61
        except QuantumClientException as ex:
47
62
            if ex.status_code != 404:
48
63
                raise ex
49
 
 
50
 
    def FnGetAtt(self, key):
51
 
        attributes = self.quantum().show_network(
52
 
            self.resource_id)['network']
53
 
        return self.handle_get_attributes(self.name, key, attributes)
 
64
        else:
 
65
            return scheduler.TaskRunner(self._confirm_delete)()
54
66
 
55
67
 
56
68
def resource_mapping():