Skip to content

Commit

Permalink
Fix swarm.port usage (#386)
Browse files Browse the repository at this point in the history
* Use integer type for port parameters

* Usage of swarm.port as config

 - remove usage as sensor

* Fix ca.server.port too

* Fix docker.port and tests

* Change docker.bind.url into a StaticSensor
  • Loading branch information
googlielmo authored and m4rkmckenna committed Nov 22, 2016
1 parent 7cf7025 commit eb6e2c2
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 26 deletions.
5 changes: 2 additions & 3 deletions common/catalog/common/ca.bom
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ brooklyn.catalog:
EMAIL_ADDRESS: $brooklyn:config("email.address")
CHALLENGE_PASSWORD: $brooklyn:config("challenge.password")
OPTIONAL_COMPANY_NAME: $brooklyn:config("optional.company.name")
CA_SERVER_PORT: $brooklyn:attributeWhenReady("ca.server.port")
CA_SERVER_PORT: $brooklyn:config("ca.server.port")
INSTALL_DIR: $brooklyn:attributeWhenReady("install.dir")
NODE_PATH:
$brooklyn:formatString:
Expand Down Expand Up @@ -197,10 +197,9 @@ brooklyn.catalog:
brooklyn.config:
enricher.triggerSensors:
- host.address
- ca.server.port
enricher.targetSensor: $brooklyn:sensor("main.uri")
enricher.targetValue:
$brooklyn:formatString:
- "http://%s:%d"
- $brooklyn:attributeWhenReady("host.address")
- $brooklyn:attributeWhenReady("ca.server.port")
- $brooklyn:config("ca.server.port")
26 changes: 10 additions & 16 deletions common/catalog/docker/docker.bom
Original file line number Diff line number Diff line change
Expand Up @@ -236,26 +236,24 @@ brooklyn.catalog:
enricher.suppressDuplicates: false
enricher.triggerSensors:
- $brooklyn:sensor("host.address")
- $brooklyn:sensor("docker.port")
enricher.targetSensor: $brooklyn:sensor("docker.endpoint.public")
enricher.targetValue:
$brooklyn:formatString:
- "%s:%d"
- $brooklyn:attributeWhenReady("host.address")
- $brooklyn:attributeWhenReady("docker.port")
- $brooklyn:config("docker.port")
- type: org.apache.brooklyn.enricher.stock.Transformer
brooklyn.config:
uniqueTag: docker-endpoint-generator
enricher.suppressDuplicates: false
enricher.triggerSensors:
- $brooklyn:sensor("host.subnet.address")
- $brooklyn:sensor("docker.port")
enricher.targetSensor: $brooklyn:sensor("docker.endpoint")
enricher.targetValue:
$brooklyn:formatString:
- "%s:%d"
- $brooklyn:attributeWhenReady("host.subnet.address")
- $brooklyn:attributeWhenReady("docker.port")
- $brooklyn:config("docker.port")
- type: org.apache.brooklyn.enricher.stock.Transformer
brooklyn.config:
uniqueTag: docker-url-generator
Expand All @@ -267,18 +265,6 @@ brooklyn.catalog:
$brooklyn:formatString:
- "tcp://%s"
- $brooklyn:attributeWhenReady("docker.endpoint")
- type: org.apache.brooklyn.enricher.stock.Transformer
brooklyn.config:
uniqueTag: docker-bind-url-generator
enricher.suppressDuplicates: false
enricher.triggerSensors:
- $brooklyn:sensor("docker.port")
enricher.targetSensor: $brooklyn:sensor("docker.bind.url")
enricher.targetValue:
$brooklyn:formatString:
- "tcp://%s:%d"
- $brooklyn:config("docker.bindaddress")
- $brooklyn:attributeWhenReady("docker.port")

brooklyn.config:
docker.cert.path:
Expand Down Expand Up @@ -363,6 +349,14 @@ brooklyn.catalog:
period: 5m
command: |
cat ${DOCKER_CERT_PATH}/csr.pem
- type: org.apache.brooklyn.core.sensor.StaticSensor
brooklyn.config:
name: docker.bind.url
static.value:
$brooklyn:formatString:
- "tcp://%s:%d"
- $brooklyn:config("docker.bindaddress")
- $brooklyn:config("docker.port")

- id: docker-engine-with-resilience
name: "Docker Engine with Resilience"
Expand Down
4 changes: 2 additions & 2 deletions common/tests/docker/docker.tests.bom
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ brooklyn.catalog:
$brooklyn:formatString:
- "%s:%d"
- $brooklyn:entity("ca-server").attributeWhenReady("host.address")
- $brooklyn:entity("ca-server").attributeWhenReady("ca.server.port")
- $brooklyn:entity("ca-server").config("ca.server.port")


# A client for talking to the engine
Expand All @@ -326,7 +326,7 @@ brooklyn.catalog:
$brooklyn:formatString:
- "tcp://%s:%s/"
- $brooklyn:entity("docker-engine-tls").attributeWhenReady("host.address")
- $brooklyn:entity("docker-engine-tls").attributeWhenReady("docker.port")
- $brooklyn:entity("docker-engine-tls").config("docker.port")

- type: docker-engine-test
name: Test Docker over TLS
Expand Down
8 changes: 3 additions & 5 deletions swarm/catalog/swarm/swarm.bom
Original file line number Diff line number Diff line change
Expand Up @@ -504,25 +504,23 @@ brooklyn.catalog:
uniqueTag: swarm-endpoint-publisher
enricher.triggerSensors:
- $brooklyn:sensor("host.subnet.address")
- $brooklyn:sensor("swarm.port")
enricher.targetSensor: $brooklyn:sensor("swarm.endpoint")
enricher.targetValue:
$brooklyn:formatString:
- "%s:%d"
- $brooklyn:attributeWhenReady("host.subnet.address")
- $brooklyn:attributeWhenReady("swarm.port")
- $brooklyn:config("swarm.port")
- type: org.apache.brooklyn.enricher.stock.Transformer
brooklyn.config:
uniqueTag: swarm-public-endpoint-publisher
enricher.triggerSensors:
- $brooklyn:sensor("host.address")
- $brooklyn:sensor("swarm.port")
enricher.targetSensor: $brooklyn:sensor("swarm.endpoint.public")
enricher.targetValue:
$brooklyn:formatString:
- "%s:%d"
- $brooklyn:attributeWhenReady("host.address")
- $brooklyn:attributeWhenReady("swarm.port")
- $brooklyn:config("swarm.port")
- type: org.apache.brooklyn.enricher.stock.Transformer
brooklyn.config:
uniqueTag: swarm-url-publisher
Expand Down Expand Up @@ -580,7 +578,7 @@ brooklyn.catalog:
brooklyn.config:
shell.env:
SWARM_DISCOVERY_URL: $brooklyn:config("swarm.discovery.url")
SWARM_PORT: $brooklyn:attributeWhenReady("swarm.port")
SWARM_PORT: $brooklyn:config("swarm.port")
SWARM_ENDPOINT: $brooklyn:attributeWhenReady("swarm.endpoint")
SWARM_URL: $brooklyn:attributeWhenReady("swarm.url")
SWARM_STRATEGY: $brooklyn:config("swarm.strategy")
Expand Down

0 comments on commit eb6e2c2

Please sign in to comment.