Skip to content
This repository has been archived by the owner on Feb 11, 2020. It is now read-only.

Commit

Permalink
Add disable-errands task
Browse files Browse the repository at this point in the history
This replaces disable-ert-errands; it now is parameterized to disable
specific errands (or all, or none) for the configured product.
  • Loading branch information
Kris Hicks committed Jun 8, 2017
1 parent f977663 commit fe5511f
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 36 deletions.
1 change: 1 addition & 0 deletions install-pcf/vsphere/params.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ dynamic_services_nw_gateway: # Dynamic Services network Gateway
dynamic_services_nw_azs: # Comma seperated list of AZ's to be associated with this network

ert_singleton_job_az: # AZ to use for deployment of ERT Singleton jobs
ert_errands_to_disable: # Comma-separated list of errand names to disable before deploy

loggregator_endpoint_port: # Loggegrator Port. Default is 443
company_name: # Company Name for Apps Manager
Expand Down
9 changes: 9 additions & 0 deletions install-pcf/vsphere/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,15 @@ jobs:
LOGGREGATOR_TC_INSTANCES: {{loggregator_traffic_controller_instances}}
TCP_ROUTER_INSTANCES: {{tcp_router_instances}}

- task: disable-errands
file: pcf-pipelines/tasks/disable-errands/task.yml
params:
PRODUCT_NAME: cf
OPSMAN_URI: {{opsman_uri}}
OPSMAN_USERNAME: {{opsman_admin_username}}
OPSMAN_PASSWORD: {{opsman_admin_password}}
ERRANDS_TO_DISABLE: {{ert_errands_to_disable}}

- task: deploy
file: pcf-pipelines/tasks/apply-changes/task.yml
params:
Expand Down
37 changes: 37 additions & 0 deletions tasks/disable-errands/task.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash -e

errands=''

if [[ "$ERRANDS_TO_DISABLE" == "all" ]]; then
errands=$(
om-linux \
--target "https://${OPSMAN_URI}" \
--skip-ssl-validation \
--username "$OPSMAN_USERNAME" \
--password "$OPSMAN_PASSWORD" \
errands \
--product-name "$PRODUCT_NAME" |
tail -n+4 | head -n-1 | grep "true" | cut -d'|' -f2 | tr -d ' '
)
elif [[ "$ERRANDS_TO_DISABLE" != "" ]] && [[ "$ERRANDS_TO_DISABLE" != "none" ]]; then
errands=$(echo "$ERRANDS_TO_DISABLE" | tr ',' '\n')
fi

if [[ -z "$errands" ]]; then
echo Nothing to do.
exit 0
fi

while read errand; do
echo -n Disabling $errand...
om-linux \
--target "https://${OPSMAN_URI}" \
--skip-ssl-validation \
--username "$OPSMAN_USERNAME" \
--password "$OPSMAN_PASSWORD" \
set-errand-state \
--product-name "$PRODUCT_NAME" \
--errand-name $errand \
--post-deploy-state "disabled"
echo done
done < <(echo "$errands")
19 changes: 19 additions & 0 deletions tasks/disable-errands/task.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
platform: linux

image_resource:
type: docker-image
source: {repository: czero/cflinuxfs2}

inputs:
- name: pcf-pipelines

params:
PRODUCT_NAME:
OPSMAN_URI:
OPSMAN_USERNAME:
OPSMAN_PASSWORD:
ERRANDS_TO_DISABLE:

run:
path: pcf-pipelines/tasks/disable-errands/task.sh
18 changes: 0 additions & 18 deletions tasks/disable-ert-errands/task.sh

This file was deleted.

18 changes: 0 additions & 18 deletions tasks/disable-ert-errands/task.yml

This file was deleted.

0 comments on commit fe5511f

Please sign in to comment.