Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion pages/EC-OpenStack_help.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1726,7 +1726,10 @@ outline used above where possible.


<h1 id="rns">Release Notes</h1>

<h2>@PLUGIN_KEY@ 1.3.4</h2>
<ul>
<li>Added Rackspace support for Dynamic Environments</li>
</ul>
<h2>@PLUGIN_KEY@ 1.3.3</h2>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We haven't published/released 1.3.3 yet so we can keep the same version number.

<ul>
<li>Added region field for create volume procedure</li>
Expand Down
4 changes: 4 additions & 0 deletions src/main/resources/project/manifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,10 @@
<path>procedures/form_scripts/parameterOptions/openStackOptions.groovy</path>
<xpath>//procedure[procedureName=&quot;_DeployDE&quot;]/propertySheet/property[propertyName=&quot;ec_form&quot;]/propertySheet/property[propertyName=&quot;parameterOptions&quot;]/propertySheet/property[propertyName=&quot;security_groups&quot;]/value</xpath>
</file>
<file>
<path>procedures/form_scripts/parameterOptions/openStackOptions.groovy</path>
<xpath>//procedure[procedureName=&quot;_DeployDE&quot;]/propertySheet/property[propertyName=&quot;ec_form&quot;]/propertySheet/property[propertyName=&quot;parameterOptions&quot;]/propertySheet/property[propertyName=&quot;region&quot;]/value</xpath>
</file>
<file>
<path>procedures/form_scripts/parameterOptions/workspaces.groovy</path>
<xpath>//procedure[procedureName=&quot;_DeployDE&quot;]/propertySheet/property[propertyName=&quot;ec_form&quot;]/propertySheet/property[propertyName=&quot;parameterOptions&quot;]/propertySheet/property[propertyName=&quot;resource_workspace&quot;]/value</xpath>
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/project/procedures/deploy_DE.pl
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@

# The availability zone : The availability zone in which to launch the server.
$opts->{availability_zone} = q{$[availability_zone]};
$opts->{region} = q{$[region]};

# Customization Script : Configuration information or scripts to execute upon launch of the server.
$opts->{customization_script} = q{$[customization_script]};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ import org.apache.http.impl.conn.SingleClientConnManager
import javax.net.ssl.SSLContext
import javax.net.ssl.TrustManager
import javax.net.ssl.X509TrustManager

import java.util.regex.*
import java.security.SecureRandom
import java.security.cert.X509Certificate

Expand Down Expand Up @@ -97,11 +99,31 @@ boolean canGetOptionsForParameter(args, formalParameterName) {
}

List getOptions(args, authToken) {
def list

String url = buildServiceURL(args)
def keystoneVersion = args.configurationParameters[IDENTITY_API_VERSION]
def response = doGet(url, authToken)
// we can't get regions from rackspace via api.
print "Url: $url\n"
if (args.formalParameterName == 'region') { // && url =~ /^https?:\/\/[a-zA-Z.]+?rackspacecloud/) {
// list = [
// ['IAD', 'Northern Virginia (IAD)'],
// ['DWF', 'Dallas-Fort Worth (DFW)'],
// ['ORD', 'Chicago (ORD)'],
// ['LON', 'London (LON)'],
// ['SYD', 'Sydney (SYD)'],
// ['HKG', 'Hong Kong (HKG)']
// ]
list = getRegions(args)
print "Regions: $list\n"
return list
}



def statusCode = response.statusLine.statusCode
def list

if (statusCode < 400) {
// Read the response based on the parameter we
// requested info for from OpenStack
Expand Down Expand Up @@ -130,6 +152,7 @@ List getOptions(args, authToken) {
list = response.jsonResponse.images.collect{
[it.id, it.name]
}
print "Images: $list\n"
break
}
}
Expand Down Expand Up @@ -162,6 +185,50 @@ String getAuthToken(args) {
token
}


List getRegions (args) {
// we need keystone api version to determine which way we'll use to get regions.
// if we have v2.0 we will construct region list from the service catalog
def keystoneVersion = args.configurationParameters[IDENTITY_API_VERSION]
// keystone is 2.0
def regions = []
def response
if (keystoneVersion == '2.0') {
def jsonPayload = buildAuthenticationPayload(args)
HttpEntity payload = new StringEntity(JsonOutput.toJson(jsonPayload))
payload.setContentType("application/json")
String url = buildIdentityServiceURL(args)
response = doPost(url, payload)
if (response.statusLine.statusCode < 400) {
response.jsonResponse.access.serviceCatalog.each {
v1 -> v1.endpoints.each {
if (it.region) {
regions.add([it.region, it.region])
}
}
}
}
return regions
}
else {
// keystone 3.0 version

String identityServiceUrl = args.configurationParameters[IDENTITY_SERVICE_URL]
String url = "$identityServiceUrl/v$keystoneAPIVersion/tokens"
token = getAuthToken(args)
response = doGet(url, token)
if (response.statusLine.statusCode < 400) {
response.jsonResponse.each {
String description = it.description ? it.description : it.id
regions.add([it.id, description])
}
}
return regions
}
return regions
}


def buildAuthenticationPayload(args) {
def jsonPayload = [:]
def keystoneAPIVersion = args.configurationParameters[IDENTITY_API_VERSION]
Expand Down Expand Up @@ -224,6 +291,9 @@ String buildServiceURL(args) {

case 'image':
return "$computeServiceUrl/v${computeServiceVersion}/$tenantId/images?status=active"

case 'region':
return "$computeServiceUrl/v${computeServiceVersion}/$tenantId/regions"

}

Expand Down
29 changes: 26 additions & 3 deletions src/main/resources/project/project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1254,6 +1254,17 @@
</property>
</propertySheet>
</property>
<property>
<propertyName>region</propertyName>
<propertySheet>
<property>
<propertyName>formType</propertyName>
<expandable>1</expandable>
<value>standard</value>
</property>
</propertySheet>
</property>

<property>
<propertyName>customization_script</propertyName>
<propertySheet>
Expand Down Expand Up @@ -1331,6 +1342,11 @@
<expandable>1</expandable>
<value/>
</property>
<property>
<propertyName>region</propertyName>
<expandable>1</expandable>
<value/>
</property>
<property>
<propertyName>security_groups</propertyName>
<expandable>1</expandable>
Expand Down Expand Up @@ -1411,16 +1427,23 @@
</formalParameter>
<formalParameter>
<formalParameterName>quantity</formalParameterName>
<defaultValue>1</defaultValue>
<defaultValue/>
<description/>
<required>1</required>
<type>entry</type>
</formalParameter>
<formalParameter>
<formalParameterName>availability_zone</formalParameterName>
<defaultValue>1</defaultValue>
<defaultValue/>
<description/>
<required>1</required>
<required>0</required>
<type>entry</type>
</formalParameter>
<formalParameter>
<formalParameterName>region</formalParameterName>
<defaultValue/>
<description/>
<required>0</required>
<type>entry</type>
</formalParameter>
<formalParameter>
Expand Down
10 changes: 10 additions & 0 deletions src/main/resources/project/ui_forms/deploy_DE.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,16 @@
<serverOptions>1</serverOptions>
<dependsOn>connection_config</dependsOn>
</formElement>
<formElement>
<label>Region:</label>
<property>region</property>
<value/>
<documentation>The region zone in which to launch the server.</documentation>
<required>0</required>
<type>entry</type>
<serverOptions>1</serverOptions>
<dependsOn>connection_config</dependsOn>
</formElement>
<formElement>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Between availability zone and region, is at least one of them required? If so, we should add it to the validations for dynamic envts.
We also need to add the drop-down for regions and have it be populated dynamically similar to availability zones.

<label>Customization script:</label>
<property>customization_script</property>
Expand Down