Skip to content

Commit

Permalink
Merge branch 'hqapi-2.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Morgan committed Dec 11, 2009
2 parents 7870fe5 + b99b10d commit 9034d51
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
2 changes: 2 additions & 0 deletions ChangeLog
Expand Up @@ -49,6 +49,8 @@ Changes in HQApi 3.0

Changes in HQApi 2.4

*) [HHQ-3603] Add support for location field for Resources.

*) [HHQ-3583] Fix handling of -s and --secure CLI options.

*) [HHQ-3565] Fix issue in MetricAPI causing all metrics to be shown as
Expand Down
21 changes: 19 additions & 2 deletions hqu/hqapi1/app/ResourceController.groovy
Expand Up @@ -11,11 +11,25 @@ class ResourceController extends ApiController {
private static final String PROP_INSTALLPATH = "installPath"
private static final String PROP_AIIDENIFIER = "autoIdentifier"

// TODO: move into ResourceCategory
private getLocation(r) {
if (r.isPlatform()) {
return r.toPlatform().location
} else if (r.isServer()) {
return r.toServer().location
} else if (r.isService()) {
return r.toService().location
}
throw new IllegalArgumentException("getLocation() called for invalid resource " +
r.name + " (id=" + r.id + ")")
}

private Closure getResourceXML(user, r, boolean verbose, boolean children) {
{ doc ->
Resource(id : r.id,
name : r.name,
description : r.description) {
description : r.description,
location : getLocation(r)) {
if (verbose) {
def config = r.getConfig()
config.each { k, v ->
Expand Down Expand Up @@ -545,9 +559,12 @@ class ResourceController extends ApiController {
def id = xmlResource.'@id'?.toInteger()
def name = xmlResource.'@name'
def description = xmlResource.'@description'
def location = xmlResource.'@location'

def config = [name: name,
description: description]
description: description,
location: location]

xmlResource['ResourceConfig'].each {
// Do not set configs for empty keys
if (it.'@value' && it.'@value'.length() > 0) {
Expand Down
1 change: 1 addition & 0 deletions xsd/HQApi1.xsd
Expand Up @@ -79,6 +79,7 @@
e.g installpath, fqdn, autoinventory identifier -->
<xs:element name="ResourceInfo" maxOccurs="unbounded" type="ResourceInfo"/>
</xs:sequence>
<xs:attribute name="location" type="xs:string" use="optional"/>
<xs:attribute name="description" type="xs:string" use="optional"/>
<xs:attribute name="name" type="xs:string" use="required"/>
<xs:attribute name="id" type="xs:int" use="optional"/>
Expand Down

0 comments on commit 9034d51

Please sign in to comment.