Merge pull request #24726 from techhat/gogridip

Allow manually assigning IP address
This commit is contained in:
Nicole Thomas 2015-06-16 17:03:48 -06:00
commit 00916acb6f
2 changed files with 27 additions and 10 deletions

View File

@ -5,11 +5,6 @@ Getting Started With GoGrid
GoGrid is a public cloud provider supporting Linux and Windows.
Dependencies
============
* Libcloud >= 0.13.2
Configuration
=============
To use Salt Cloud with GoGrid log into the GoGrid web interface and create an
@ -97,4 +92,23 @@ command:
CentOS 6.4 (64-bit) w/ None
uuid:
bfd4055389919e01aa6261828a96cf54c8dcc2c4
...SNIP...
...SNIP...
Assigning IPs
=============
.. versionadded:: Beryllium
The GoGrid API allows IP addresses to be manually assigned. Salt Cloud supports
this functionality by allowing an IP address to be specified using the
``assign_public_ip`` argument. This likely makes the most sense inside a map
file, but it may also be used inside a profile.
.. code-block:: yaml
gogrid_512:
provider: my-gogrid-config
size: 512MB
image: CentOS 6.2 (64-bit) w/ None
assign_public_ip: 11.38.257.42

View File

@ -83,10 +83,13 @@ def create(vm_):
log.info('Creating Cloud VM {0}'.format(vm_['name']))
image_id = avail_images()[vm_['image']]['id']
public_ips = list_public_ips()
if len(public_ips.keys()) < 1:
raise SaltCloudException('No more IPs available')
host_ip = public_ips.keys()[0]
if 'assign_public_ip' in vm_:
host_ip = vm_['assign_public_ip']
else:
public_ips = list_public_ips()
if len(public_ips.keys()) < 1:
raise SaltCloudException('No more IPs available')
host_ip = public_ips.keys()[0]
create_kwargs = {
'name': vm_['name'],