Skip to content

Commit e436e40

Browse files
authored
Merge pull request #162 from cloudgraphdev/aa-fixes
small fixes for cloud9 and dynamodb
2 parents aeaa26d + 6b9395c commit e436e40

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/services/cloud9/data.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ const errorLog = new AwsErrorLog(serviceName)
2828
const endpoint = initTestEndpoint(serviceName)
2929
const MAX_ITEMS = 25
3030

31-
const listEnvironmentsForRegion = async ({
32-
cloud9,
31+
const listEnvironmentsForRegion = async ({
32+
cloud9,
3333
resolveRegion,
3434
}: {
3535
cloud9: Cloud9
@@ -150,7 +150,7 @@ export default async ({
150150
[region: string]: RawAwsCloud9Environment[]
151151
}> =>
152152
new Promise(async resolve => {
153-
const cloud9Data: RawAwsCloud9Environment[] = []
153+
let cloud9Data: RawAwsCloud9Environment[] = []
154154
const environmentPromises = []
155155
const regionPromises = []
156156
const tagsPromises = []
@@ -208,6 +208,8 @@ export default async ({
208208
logger.debug(lt.gettingCloud9Environments)
209209
await Promise.all(environmentPromises)
210210

211+
// remove environments that don't have an arn (failed to get attributes)
212+
cloud9Data = cloud9Data.filter(({ arn }) => !!arn)
211213
// get all tags for each environment
212214
cloud9Data.map(({ arn, region }, idx) => {
213215
const cloud9 = new Cloud9({ ...config, region, endpoint })

src/services/dynamodb/data.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export interface RawAwsDynamoDbTable
4949
}
5050

5151
const checkIfEnabled = (status: string): boolean =>
52-
status && !['DISABLED', 'DISABLING'].includes(status)
52+
!!status && !['DISABLED', 'DISABLING'].includes(status)
5353

5454
const ttlInfoFormatter = (ttlInfo: TimeToLiveDescription): boolean => {
5555
const { TimeToLiveStatus } = ttlInfo
@@ -59,10 +59,9 @@ const ttlInfoFormatter = (ttlInfo: TimeToLiveDescription): boolean => {
5959
const backupInfoFormatter = (
6060
backupInfo: ContinuousBackupsDescription
6161
): boolean => {
62-
const {
63-
PointInTimeRecoveryDescription: { PointInTimeRecoveryStatus },
64-
} = backupInfo
65-
return checkIfEnabled(PointInTimeRecoveryStatus)
62+
const status =
63+
backupInfo?.PointInTimeRecoveryDescription?.PointInTimeRecoveryStatus
64+
return checkIfEnabled(status)
6665
}
6766

6867
/**
@@ -345,8 +344,7 @@ export default async ({
345344
tableData.map(({ TableName, region }, idx) => {
346345
const dynamoDb = new DynamoDB({ ...config, region, endpoint })
347346
const backupInfoPromise = new Promise<void>(async resolveBackupInfo => {
348-
const backupInfo: ContinuousBackupsDescription =
349-
await getTableBackupsDescription(dynamoDb, TableName)
347+
const backupInfo = await getTableBackupsDescription(dynamoDb, TableName)
350348
tableData[idx].pointInTimeRecoveryEnabled =
351349
backupInfoFormatter(backupInfo)
352350
resolveBackupInfo()

0 commit comments

Comments
 (0)