Skip to content

Commit

Permalink
EC-255 - Remove leading/trailing whitespace when normalizing tags
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeshimkus committed Aug 3, 2023
1 parent 06a018d commit bf3ee1e
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 8 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,5 @@ deployment_info.json
temp_*
sdk/dist/*
env.sh
test/test/*
test/test/*
npm-debug.log
4 changes: 2 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ test_functional_init_gcp:
extends: .test-install
variables:
PLAN: "gcp"
PARAMETERS: "region=us-west1"
PARAMETERS: "region=us-west1 bigip_version=f5-bigip-16-1-3-3-0-0-3-payg-best-plus-25mbps-221222234728"
except:
variables:
- $TESTS_TIER == "2"
Expand All @@ -287,7 +287,7 @@ test_functional_init_gcp_no_forwarding:
extends: .test-install
variables:
PLAN: "gcp"
PARAMETERS: "region=us-west1 use_forwarding_rule=false"
PARAMETERS: "region=us-west1 use_forwarding_rule=false bigip_version=f5-bigip-16-1-3-3-0-0-3-payg-best-plus-25mbps-221222234728"
except:
variables:
- $TESTS_TIER == "1"
Expand Down
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
"cache": false
},
"resolutions": {
"google-p12-pem": "^3.0.3",
"gcp-metadata": "^4.2.0",
"google-p12-pem": "^2.0.5",
"gcp-metadata": "^3.5.0",
"node-forge": "^1.3.0",
"json-bigint": "^1.0.0",
"ansi-regex": "^4.1.1",
Expand All @@ -56,7 +56,7 @@
"@f5devcentral/f5-cloud-libs": "4.14.0",
"@f5devcentral/f5-teem": "1.5.0",
"@google-cloud/compute": "^1.2.0",
"@google-cloud/storage": "^4.3.1",
"@google-cloud/storage": "^4.7.2",
"ajv": "^6.10.0",
"aws-sdk": "^2.1034.0",
"azure-arm-network": "^13.0.0",
Expand Down Expand Up @@ -161,7 +161,8 @@
"1089848",
"1090460",
"1091350",
"1091351"
"1091351",
"1092826"
]
}
}
8 changes: 8 additions & 0 deletions src/nodejs/providers/abstract/cloud.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ class AbstractCloud {
* @returns {Object} - tags: { 'key1': 'value1' }
*/
_normalizeTags(tags) {
this.logger.silly('_normalizeTags received tags:', tags);
let ret = {};
if (Array.isArray(tags)) {
ret = tags.reduce((acc, cur) => {
Expand All @@ -303,6 +304,13 @@ class AbstractCloud {
} else {
ret = tags;
}
Object.entries(ret).forEach((entry) => {
if (entry[0] !== undefined && entry[1] !== undefined) {
const key = entry[0].trim();
ret[key] = entry[1].trim();
}
});
this.logger.silly('_normalizeTags finished processing tags:', ret);
return ret;
}

Expand Down
2 changes: 1 addition & 1 deletion test/unit/providers/gcpProviderTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ const mockMultipleZoneVms = [
}
];

const routeTableDescription = 'f5_cloud_failover_labels={"mylabel":"mydeployment","f5_self_ips":["1.1.1.1","1.1.1.2"]}';
const routeTableDescription = 'f5_cloud_failover_labels={"mylabel":"mydeployment","f5_self_ips":"1.1.1.1,1.1.1.2"}';
const fwdRuleDescription = 'f5_cloud_failover_labels={"mylabel":"mydeployment","f5_target_instance_pair":"testInstanceName01,testInstanceName02"}';

describe('Provider - GCP', () => {
Expand Down

0 comments on commit bf3ee1e

Please sign in to comment.