~ubuntu-branches/ubuntu/vivid/heat/vivid

« back to all changes in this revision

Viewing changes to heat/engine/resources/nova_floatingip.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short, Chuck Short, Corey Bryant
  • Date: 2015-01-06 08:55:22 UTC
  • mfrom: (1.1.21)
  • Revision ID: package-import@ubuntu.com-20150106085522-4o3hnaff5lacvtrf
Tags: 2015.1~b1-0ubuntu1
[ Chuck Short ]
* Open up for vivid.
* debian/control: Update bzr branch. 
* debian/control: Add python-saharaclient,
  python-osprofiler, python-oslo.middleware, python-oslo.serialization.
* debian/patches/fix-reqirements.patch: Refreshed.
* debian/patches/skip-tests.patch: Updated to skip more tests.
* debian/rules: Skip integration tests.

[ Corey Bryant ]
* New upstream release.
  - d/control: Align requirements with upstream.
  - d/watch: Update uversionmangle for kilo beta naming.
  - d/rules: Generate heat.conf.sample and apply patch before copy.
  - d/rules: Run base tests instead of integration tests.
  - d/p/fix-requirements.patch: Refreshed.
  - d/p/remove-gettextutils-import.patch: Cherry picked from master.
* d/control: Bumped Standards-Version to 3.9.6.

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
11
11
#    License for the specific language governing permissions and limitations
12
12
#    under the License.
 
13
import six
13
14
 
14
15
from oslo.utils import excutils
15
16
 
16
17
from heat.common.i18n import _
 
18
from heat.common.i18n import _LE
17
19
from heat.engine import attributes
 
20
from heat.engine import constraints
18
21
from heat.engine import properties
19
22
from heat.engine import resource
 
23
from heat.engine import support
20
24
from heat.openstack.common import log as logging
21
25
 
22
26
LOG = logging.getLogger(__name__)
23
27
 
24
28
 
25
29
class NovaFloatingIp(resource.Resource):
 
30
    support_status = support.SupportStatus(version='2014.1')
 
31
 
26
32
    PROPERTIES = (POOL,) = ('pool',)
27
33
 
28
34
    ATTRIBUTES = (
68
74
            with excutils.save_and_reraise_exception():
69
75
                if self.client_plugin().is_not_found(e):
70
76
                    if pool is None:
71
 
                        msg = _('Could not allocate floating IP. Probably '
72
 
                                'there is no default floating IP pool is '
73
 
                                'configured.')
74
 
                        LOG.error(msg)
 
77
                        LOG.error(_LE('Could not allocate floating IP. '
 
78
                                      'Probably there is no default floating'
 
79
                                      ' IP pool is configured.'))
75
80
 
76
81
        self.resource_id_set(floating_ip.id)
77
82
        self._floating_ip = floating_ip
89
94
            self.POOL_ATTR: getattr(floating_ip, self.POOL_ATTR, None),
90
95
            self.IP: floating_ip.ip
91
96
        }
92
 
        return unicode(attributes[key])
 
97
        return six.text_type(attributes[key])
93
98
 
94
99
 
95
100
class NovaFloatingIpAssociation(resource.Resource):
 
101
    support_status = support.SupportStatus(version='2014.1')
 
102
 
96
103
    PROPERTIES = (
97
104
        SERVER, FLOATING_IP
98
105
    ) = (
104
111
            properties.Schema.STRING,
105
112
            _('Server to assign floating IP to.'),
106
113
            required=True,
107
 
            update_allowed=True
 
114
            update_allowed=True,
 
115
            constraints=[
 
116
                constraints.CustomConstraint('nova.server')
 
117
            ]
108
118
        ),
109
119
        FLOATING_IP: properties.Schema(
110
120
            properties.Schema.STRING,
114
124
        ),
115
125
    }
116
126
 
 
127
    default_client_name = 'nova'
 
128
 
117
129
    def FnGetRefId(self):
118
130
        return self.physical_resource_name_or_FnGetRefId()
119
131