Skip to content

Commit 0977aa5

Browse files
authored
Merge pull request #46 from f5devcentral/v1.4.1
1.4.1 objCounter bug Nov 2023
2 parents 8313344 + b81952b commit 0977aa5

10 files changed

+4388
-4380
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
2323

2424

2525

26+
---
27+
28+
## [1.4.1] - (11.03.2023)
29+
30+
### Fixed
31+
32+
- bug in objCounter when missing properties/objects
33+
2634
---
2735

2836
## [1.4.0] - (07.11.2023)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "f5-corkscrew",
33
"description": "extracting tmos config",
44
"author": "F5DevCentral",
5-
"version": "1.4.0",
5+
"version": "1.4.1",
66
"license": "Apache-2.0",
77
"homepage": "https://github.com/f5devcentral/f5-corkscrew#readme",
88
"main": "dist/index.js",

src/objCounter.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,26 +49,26 @@ export async function countObjects (obj: BigipConfObj): Promise<ObjStats> {
4949

5050

5151
// GTM stats
52-
if(obj.gtm) {
52+
if(obj?.gtm) {
5353
// here we return/assign the value
5454
stats.gtm = await countGSLB(obj);
5555
}
5656

57-
if(obj.apm) {
57+
if(obj?.apm) {
5858
// here we pass in the main stats object and add stats in the function
5959
await countAPM(obj, stats)
6060
}
6161

6262
// asm policies are refenced by local traffic policies on each vs
63-
if(obj.asm?.policy) {
63+
if(obj?.asm?.policy) {
6464
stats.asmPolicies = Object.keys(obj.asm.policy).length;
6565
}
6666

67-
if(obj.security['bot-defense']) {
67+
if(obj?.security?.['bot-defense']) {
6868
stats.botProfiles = Object.keys(obj.security['bot-defense']).length;
6969
}
7070

71-
if(obj.security.dos) {
71+
if(obj?.security?.dos) {
7272
stats.dosProfiles = Object.keys(obj.security.dos).length;
7373
}
7474

@@ -82,13 +82,13 @@ export async function countAPM(obj: BigipConfObj, stats: ObjStats): Promise<void
8282

8383
// count access policies
8484
// apm policy access-policy <name> <details>
85-
if(obj.apm.policy?.['access-policy']) {
85+
if(obj?.apm?.policy?.['access-policy']) {
8686
stats.apmPolicies = Object.keys(obj.apm.policy['access-policy']).length;
8787
}
8888

8989
// count access profiles
9090
// apm profile access <name> <details
91-
if(obj.apm.profile?.access) {
91+
if(obj?.apm?.profile?.access) {
9292
stats.apmProfiles = Object.keys(obj.apm.profile.access).length;
9393
}
9494

@@ -112,7 +112,7 @@ export async function countGSLB(obj: BigipConfObj): Promise<GslbStats> {
112112
parents.forEach( p => {
113113

114114
// if parent found in obj.gtm object
115-
if(obj.gtm[p]) {
115+
if(obj?.gtm?.[p]) {
116116
// count the keys
117117
gtmStats[`${p}s`] = Object.keys(obj.gtm[p]).length;
118118
}
@@ -122,7 +122,7 @@ export async function countGSLB(obj: BigipConfObj): Promise<GslbStats> {
122122
// pools and wideips have named children object for the different record types
123123
// so we need to dig a bit deeper into each one
124124

125-
if(obj.gtm.pool) {
125+
if(obj?.gtm?.pool) {
126126

127127
// we have some gslb pools so, create the param and set the initial value
128128
gtmStats.pools = 0
@@ -142,7 +142,7 @@ export async function countGSLB(obj: BigipConfObj): Promise<GslbStats> {
142142
})
143143
}
144144

145-
if(obj.gtm.wideip) {
145+
if(obj?.gtm?.wideip) {
146146

147147
gtmStats.wideips = 0;
148148

tests/artifacts/f5_corkscrew_test.conf.log

Lines changed: 604 additions & 604 deletions
Large diffs are not rendered by default.

tests/artifacts/f5_corkscrew_test.conf.log.json

Lines changed: 603 additions & 603 deletions
Large diffs are not rendered by default.

tests/artifacts/f5_corkscrew_test.qkview.log

Lines changed: 826 additions & 826 deletions
Large diffs are not rendered by default.

tests/artifacts/f5_corkscrew_test.qkview.log.json

Lines changed: 825 additions & 825 deletions
Large diffs are not rendered by default.
-2 Bytes
Binary file not shown.

tests/artifacts/f5_corkscrew_test.ucs.log

Lines changed: 756 additions & 756 deletions
Large diffs are not rendered by default.

tests/artifacts/f5_corkscrew_test.ucs.log.json

Lines changed: 755 additions & 755 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)