Skip to content

Instantly share code, notes, and snippets.

@boina-n
Last active December 26, 2018 15:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save boina-n/388ec6bb13f41d2478b46a82c9218076 to your computer and use it in GitHub Desktop.
Save boina-n/388ec6bb13f41d2478b46a82c9218076 to your computer and use it in GitHub Desktop.
Compare Pivotal Cloud foundry product between 2 plateforms
diff <(jq -S . director_properties.prod.json) <(jq -S . director_properties.stg.json)
< "keep_unreachable_vms": true,
---
> "keep_unreachable_vms": false,
56c56
< "disk_size": 153600,
---
> "disk_size": 102400,
#########
#
# DIRECTOR DIFF
#
##########
# STAGING
unlink params.env
ln -s params-staging.env params.env
pf=stg
./omix.sh curl --path /api/v0/staged/director/properties > compare-platform-properties/director_properties.$pf.json
./omix.sh curl --path /api/v0/staged/director/availability_zones > compare-platform-properties/director_availability_zones.$pf.json
./omix.sh curl --path /api/v0/staged/director/networks > compare-platform-properties/director_networks.$pf.json
./omix.sh curl --path /api/v0/staged/director/manifest > compare-platform-properties/director_manifest.$pf.json
#PRODUCTION
unlink params.env
ln -s params-prod.env params.env
pf=prod
./omix.sh curl --path /api/v0/staged/director/properties > compare-platform-properties/director_properties.$pf.json
./omix.sh curl --path /api/v0/staged/director/availability_zones > compare-platform-properties/director_availability_zones.$pf.json
./omix.sh curl --path /api/v0/staged/director/networks > compare-platform-properties/director_networks.$pf.json
./omix.sh curl --path /api/v0/staged/director/manifest > compare-platform-properties/director_manifest.$pf.json
sections="properties networks manifest availability_zones"
for section in $sections ; do diff <(jq -S . director_$section.prod.json) <(jq -S . director_$section.stg.json) > director_$section.prod-stg.diff ; done
################
#
# Product resources DIFF
#
###############
unlink params.env
ln -s params-staging.env params.env
pf=stg
./omix.sh curl --path /api/v0/staged/products | jq -r '.[] | .guid' | while read product_guid ; do ./omix.sh curl --path /api/v0/staged/products/$product_guid/resources > compare-platform-properties/$product_guid.resources.$pf.json ; done
unlink params.env
ln -s params-staging.env params.env
pf=prod
./omix.sh curl --path /api/v0/staged/products | jq -r '.[] | .guid' | while read product_guid ; do ./omix.sh curl --path /api/v0/staged/products/$product_guid/resources > compare-platform-properties/$product_guid.resources.$pf.json ; done
./omix.sh curl --path /api/v0/staged/products | jq -r '.[] | .guid' | while read product_guid ; do diff <(jq -S . $product_guid.resources.stg.json) <(jq -S . $product_guid.resources.prod.json) ; done
## ONE SHOT ####
omix.sh staged-products -f json | jq ' .[] | .name' | tr -d '"' | while read product ; do omix.sh staged-config --product-name $product > pcf-staging-$product-config.yaml ; done
omix.sh staged-products -f json | jq ' .[] | .name' | tr -d '"' | while read product ; do omix.sh staged-config --product-name $product > pcf-production-$product-config.yaml ; done
omix.sh staged-products -f json | jq ' .[] | .name' | tr -d '"' | while read product ; do echo " ### $product ### "; yamldiff --file1 pcf-production-$product-config.yaml --file2 pcf-staging-$product-config.yaml ; echo ;echo ; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment