diff --git a/bumiworker/bumiworker/modules/recommendations/insecure_security_groups.py b/bumiworker/bumiworker/modules/recommendations/insecure_security_groups.py
index 330d111dd..b1a367b1a 100644
--- a/bumiworker/bumiworker/modules/recommendations/insecure_security_groups.py
+++ b/bumiworker/bumiworker/modules/recommendations/insecure_security_groups.py
@@ -159,8 +159,7 @@ def _get_aws_insecure(self, config, resources, excluded_pools,
if s_groups is None:
continue
security_groups_map = region_sg_map[region]
- for group in s_groups:
- group_id = group['GroupId']
+ for group_id in s_groups:
instances = security_groups_map.get(group_id, [])
instances.append(instance)
security_groups_map[group_id] = instances
diff --git a/jira_ui/ui/package-lock.json b/jira_ui/ui/package-lock.json
index 1a233eb31..5199b788b 100644
--- a/jira_ui/ui/package-lock.json
+++ b/jira_ui/ui/package-lock.json
@@ -27,8 +27,8 @@
"react-markdown": "^9.0.1",
"react-router-dom": "^6.19.0",
"remark-gfm": "^4.0.0",
- "vite": "^5.4.6",
- "vite-tsconfig-paths": "^5.0.1"
+ "vite": "^5.4.11",
+ "vite-tsconfig-paths": "^5.1.4"
},
"devDependencies": {
"eslint": "^8.57.0",
@@ -7993,9 +7993,9 @@
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
},
"node_modules/nanoid": {
- "version": "3.3.7",
- "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz",
- "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==",
+ "version": "3.3.8",
+ "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz",
+ "integrity": "sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==",
"funding": [
{
"type": "github",
@@ -9899,9 +9899,9 @@
}
},
"node_modules/vite": {
- "version": "5.4.6",
- "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.6.tgz",
- "integrity": "sha512-IeL5f8OO5nylsgzd9tq4qD2QqI0k2CQLGrWD0rCN0EQJZpBK5vJAx0I+GDkMOXxQX/OfFHMuLIx6ddAxGX/k+Q==",
+ "version": "5.4.11",
+ "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.11.tgz",
+ "integrity": "sha512-c7jFQRklXua0mTzneGW9QVyxFjUgwcihC4bXEtujIo2ouWCe1Ajt/amn2PCxYnhYfd5k09JX3SB7OYWFKYqj8Q==",
"dependencies": {
"esbuild": "^0.21.3",
"postcss": "^8.4.43",
@@ -9957,9 +9957,9 @@
}
},
"node_modules/vite-tsconfig-paths": {
- "version": "5.0.1",
- "resolved": "https://registry.npmjs.org/vite-tsconfig-paths/-/vite-tsconfig-paths-5.0.1.tgz",
- "integrity": "sha512-yqwv+LstU7NwPeNqajZzLEBVpUFU6Dugtb2P84FXuvaoYA+/70l9MHE+GYfYAycVyPSDYZ7mjOFuYBRqlEpTig==",
+ "version": "5.1.4",
+ "resolved": "https://registry.npmjs.org/vite-tsconfig-paths/-/vite-tsconfig-paths-5.1.4.tgz",
+ "integrity": "sha512-cYj0LRuLV2c2sMqhqhGpaO3LretdtMn/BVX4cPLanIZuwwrkVl+lK84E/miEXkCHWXuq65rhNN4rXsBcOB3S4w==",
"dependencies": {
"debug": "^4.1.1",
"globrex": "^0.1.2",
@@ -15556,9 +15556,9 @@
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
},
"nanoid": {
- "version": "3.3.7",
- "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz",
- "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g=="
+ "version": "3.3.8",
+ "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz",
+ "integrity": "sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w=="
},
"natural-compare": {
"version": "1.4.0",
@@ -16862,9 +16862,9 @@
}
},
"vite": {
- "version": "5.4.6",
- "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.6.tgz",
- "integrity": "sha512-IeL5f8OO5nylsgzd9tq4qD2QqI0k2CQLGrWD0rCN0EQJZpBK5vJAx0I+GDkMOXxQX/OfFHMuLIx6ddAxGX/k+Q==",
+ "version": "5.4.11",
+ "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.11.tgz",
+ "integrity": "sha512-c7jFQRklXua0mTzneGW9QVyxFjUgwcihC4bXEtujIo2ouWCe1Ajt/amn2PCxYnhYfd5k09JX3SB7OYWFKYqj8Q==",
"requires": {
"esbuild": "^0.21.3",
"fsevents": "~2.3.3",
@@ -16873,9 +16873,9 @@
}
},
"vite-tsconfig-paths": {
- "version": "5.0.1",
- "resolved": "https://registry.npmjs.org/vite-tsconfig-paths/-/vite-tsconfig-paths-5.0.1.tgz",
- "integrity": "sha512-yqwv+LstU7NwPeNqajZzLEBVpUFU6Dugtb2P84FXuvaoYA+/70l9MHE+GYfYAycVyPSDYZ7mjOFuYBRqlEpTig==",
+ "version": "5.1.4",
+ "resolved": "https://registry.npmjs.org/vite-tsconfig-paths/-/vite-tsconfig-paths-5.1.4.tgz",
+ "integrity": "sha512-cYj0LRuLV2c2sMqhqhGpaO3LretdtMn/BVX4cPLanIZuwwrkVl+lK84E/miEXkCHWXuq65rhNN4rXsBcOB3S4w==",
"requires": {
"debug": "^4.1.1",
"globrex": "^0.1.2",
diff --git a/jira_ui/ui/package.json b/jira_ui/ui/package.json
index 33a6b201b..2e15ffde1 100644
--- a/jira_ui/ui/package.json
+++ b/jira_ui/ui/package.json
@@ -23,8 +23,8 @@
"react-markdown": "^9.0.1",
"react-router-dom": "^6.19.0",
"remark-gfm": "^4.0.0",
- "vite": "^5.4.6",
- "vite-tsconfig-paths": "^5.0.1"
+ "vite": "^5.4.11",
+ "vite-tsconfig-paths": "^5.1.4"
},
"scripts": {
"start": "vite",
diff --git a/ngui/ui/package.json b/ngui/ui/package.json
index 727184584..c17060d9e 100644
--- a/ngui/ui/package.json
+++ b/ngui/ui/package.json
@@ -28,7 +28,7 @@
"@types/react": "^18.2.45",
"@types/react-dom": "^18.2.18",
"@uiw/react-textarea-code-editor": "^2.1.1",
- "@vitejs/plugin-react-swc": "^3.7.0",
+ "@vitejs/plugin-react-swc": "^3.7.2",
"ajv": "^8.12.0",
"analytics": "^0.8.1",
"axios": "^1.7.4",
@@ -74,8 +74,8 @@
"typescript": "^5.3.3",
"unist-util-visit": "^5.0.0",
"uuid": "^9.0.0",
- "vite": "^5.4.6",
- "vite-tsconfig-paths": "^5.0.1"
+ "vite": "^5.4.11",
+ "vite-tsconfig-paths": "^5.1.4"
},
"scripts": {
"start": "vite",
diff --git a/ngui/ui/pnpm-lock.yaml b/ngui/ui/pnpm-lock.yaml
index b471b76ae..2043df4bc 100644
--- a/ngui/ui/pnpm-lock.yaml
+++ b/ngui/ui/pnpm-lock.yaml
@@ -81,8 +81,8 @@ dependencies:
specifier: ^2.1.1
version: 2.1.1(@babel/runtime@7.24.7)(react-dom@18.2.0)(react@18.2.0)
'@vitejs/plugin-react-swc':
- specifier: ^3.7.0
- version: 3.7.0(vite@5.4.6)
+ specifier: ^3.7.2
+ version: 3.7.2(vite@5.4.11)
ajv:
specifier: ^8.12.0
version: 8.12.0
@@ -219,11 +219,11 @@ dependencies:
specifier: ^9.0.0
version: 9.0.0
vite:
- specifier: ^5.4.6
- version: 5.4.6(@types/node@20.10.5)
+ specifier: ^5.4.11
+ version: 5.4.11(@types/node@20.10.5)
vite-tsconfig-paths:
- specifier: ^5.0.1
- version: 5.0.1(typescript@5.3.3)(vite@5.4.6)
+ specifier: ^5.1.4
+ version: 5.1.4(typescript@5.3.3)(vite@5.4.11)
devDependencies:
'@storybook/addon-actions':
@@ -246,7 +246,7 @@ devDependencies:
version: 7.6.20(react-dom@18.2.0)(react@18.2.0)(typescript@5.3.3)
'@storybook/react-vite':
specifier: ^7.6.20
- version: 7.6.20(react-dom@18.2.0)(react@18.2.0)(typescript@5.3.3)(vite@5.4.6)
+ version: 7.6.20(react-dom@18.2.0)(react@18.2.0)(typescript@5.3.3)(vite@5.4.11)
'@storybook/theming':
specifier: ^7.6.5
version: 7.6.5(react-dom@18.2.0)(react@18.2.0)
@@ -2831,7 +2831,7 @@ packages:
chalk: 4.1.2
dev: true
- /@joshwooding/vite-plugin-react-docgen-typescript@0.3.0(typescript@5.3.3)(vite@5.4.6):
+ /@joshwooding/vite-plugin-react-docgen-typescript@0.3.0(typescript@5.3.3)(vite@5.4.11):
resolution: {integrity: sha512-2D6y7fNvFmsLmRt6UCOFJPvFoPMJGT0Uh1Wg0RaigUp7kdQPs6yYn8Dmx6GZkOH/NW0yMTwRz/p0SRMMRo50vA==}
peerDependencies:
typescript: '>= 4.3.x'
@@ -2845,7 +2845,7 @@ packages:
magic-string: 0.27.0
react-docgen-typescript: 2.2.2(typescript@5.3.3)
typescript: 5.3.3
- vite: 5.4.6(@types/node@20.10.5)
+ vite: 5.4.11(@types/node@20.10.5)
dev: true
/@jridgewell/gen-mapping@0.3.3:
@@ -4650,7 +4650,7 @@ packages:
- supports-color
dev: true
- /@storybook/builder-vite@7.6.20(typescript@5.3.3)(vite@5.4.6):
+ /@storybook/builder-vite@7.6.20(typescript@5.3.3)(vite@5.4.11):
resolution: {integrity: sha512-q3vf8heE7EaVYTWlm768ewaJ9lh6v/KfoPPeHxXxzSstg4ByP9kg4E1mrfAo/l6broE9E9zo3/Q4gsM/G/rw8Q==}
peerDependencies:
'@preact/preset-vite': '*'
@@ -4682,7 +4682,7 @@ packages:
magic-string: 0.30.5
rollup: 3.29.5
typescript: 5.3.3
- vite: 5.4.6(@types/node@20.10.5)
+ vite: 5.4.11(@types/node@20.10.5)
transitivePeerDependencies:
- encoding
- supports-color
@@ -5087,7 +5087,7 @@ packages:
react-dom: 18.2.0(react@18.2.0)
dev: true
- /@storybook/react-vite@7.6.20(react-dom@18.2.0)(react@18.2.0)(typescript@5.3.3)(vite@5.4.6):
+ /@storybook/react-vite@7.6.20(react-dom@18.2.0)(react@18.2.0)(typescript@5.3.3)(vite@5.4.11):
resolution: {integrity: sha512-uKuBFyGPZxpfR8vpDU/2OE9v7iTaxwL7ldd7k1swYd1rTSAPacTnEHSMl1R5AjUhkdI7gRmGN9q7qiVfK2XJCA==}
engines: {node: '>=16'}
peerDependencies:
@@ -5095,16 +5095,16 @@ packages:
react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0
vite: ^3.0.0 || ^4.0.0 || ^5.0.0
dependencies:
- '@joshwooding/vite-plugin-react-docgen-typescript': 0.3.0(typescript@5.3.3)(vite@5.4.6)
+ '@joshwooding/vite-plugin-react-docgen-typescript': 0.3.0(typescript@5.3.3)(vite@5.4.11)
'@rollup/pluginutils': 5.1.0
- '@storybook/builder-vite': 7.6.20(typescript@5.3.3)(vite@5.4.6)
+ '@storybook/builder-vite': 7.6.20(typescript@5.3.3)(vite@5.4.11)
'@storybook/react': 7.6.20(react-dom@18.2.0)(react@18.2.0)(typescript@5.3.3)
- '@vitejs/plugin-react': 3.1.0(vite@5.4.6)
+ '@vitejs/plugin-react': 3.1.0(vite@5.4.11)
magic-string: 0.30.5
react: 18.2.0
react-docgen: 7.0.1
react-dom: 18.2.0(react@18.2.0)
- vite: 5.4.6(@types/node@20.10.5)
+ vite: 5.4.11(@types/node@20.10.5)
transitivePeerDependencies:
- '@preact/preset-vite'
- encoding
@@ -6049,18 +6049,18 @@ packages:
resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==}
dev: true
- /@vitejs/plugin-react-swc@3.7.0(vite@5.4.6):
- resolution: {integrity: sha512-yrknSb3Dci6svCd/qhHqhFPDSw0QtjumcqdKMoNNzmOl5lMXTTiqzjWtG4Qask2HdvvzaNgSunbQGet8/GrKdA==}
+ /@vitejs/plugin-react-swc@3.7.2(vite@5.4.11):
+ resolution: {integrity: sha512-y0byko2b2tSVVf5Gpng1eEhX1OvPC7x8yns1Fx8jDzlJp4LS6CMkCPfLw47cjyoMrshQDoQw4qcgjsU9VvlCew==}
peerDependencies:
- vite: ^4 || ^5
+ vite: ^4 || ^5 || ^6
dependencies:
'@swc/core': 1.7.26
- vite: 5.4.6(@types/node@20.10.5)
+ vite: 5.4.11(@types/node@20.10.5)
transitivePeerDependencies:
- '@swc/helpers'
dev: false
- /@vitejs/plugin-react@3.1.0(vite@5.4.6):
+ /@vitejs/plugin-react@3.1.0(vite@5.4.11):
resolution: {integrity: sha512-AfgcRL8ZBhAlc3BFdigClmTUMISmmzHn7sB2h9U1odvc5U/MjWXsAaz18b/WoppUTDBzxOJwo2VdClfUcItu9g==}
engines: {node: ^14.18.0 || >=16.0.0}
peerDependencies:
@@ -6071,7 +6071,7 @@ packages:
'@babel/plugin-transform-react-jsx-source': 7.23.3(@babel/core@7.23.6)
magic-string: 0.27.0
react-refresh: 0.14.0
- vite: 5.4.6(@types/node@20.10.5)
+ vite: 5.4.11(@types/node@20.10.5)
transitivePeerDependencies:
- supports-color
dev: true
@@ -11471,8 +11471,8 @@ packages:
resolution: {integrity: sha512-TvmkNhkv8yct0SVBSy+o8wYzXjE4Zz3PCesbfs8HiCXXdcTuocApFv11UWlNFWKYsP2okqrhb7JNlSm9InBhIw==}
dev: false
- /nanoid@3.3.7:
- resolution: {integrity: sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==}
+ /nanoid@3.3.8:
+ resolution: {integrity: sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==}
engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
hasBin: true
@@ -12115,7 +12115,7 @@ packages:
resolution: {integrity: sha512-56rxCq7G/XfB4EkXq9Egn5GCqugWvDFjafDOThIdMBsI15iqPqR5r15TfSr1YPYeEI19YeaXMCbY6u88Y76GLQ==}
engines: {node: ^10 || ^12 || >=14}
dependencies:
- nanoid: 3.3.7
+ nanoid: 3.3.8
picocolors: 1.1.0
source-map-js: 1.2.1
@@ -14586,7 +14586,7 @@ packages:
mlly: 1.4.2
pathe: 1.1.2
picocolors: 1.1.0
- vite: 5.4.6(@types/node@20.10.5)
+ vite: 5.4.11(@types/node@20.10.5)
transitivePeerDependencies:
- '@types/node'
- less
@@ -14599,8 +14599,8 @@ packages:
- terser
dev: true
- /vite-tsconfig-paths@5.0.1(typescript@5.3.3)(vite@5.4.6):
- resolution: {integrity: sha512-yqwv+LstU7NwPeNqajZzLEBVpUFU6Dugtb2P84FXuvaoYA+/70l9MHE+GYfYAycVyPSDYZ7mjOFuYBRqlEpTig==}
+ /vite-tsconfig-paths@5.1.4(typescript@5.3.3)(vite@5.4.11):
+ resolution: {integrity: sha512-cYj0LRuLV2c2sMqhqhGpaO3LretdtMn/BVX4cPLanIZuwwrkVl+lK84E/miEXkCHWXuq65rhNN4rXsBcOB3S4w==}
peerDependencies:
vite: '*'
peerDependenciesMeta:
@@ -14610,14 +14610,14 @@ packages:
debug: 4.3.5
globrex: 0.1.2
tsconfck: 3.0.3(typescript@5.3.3)
- vite: 5.4.6(@types/node@20.10.5)
+ vite: 5.4.11(@types/node@20.10.5)
transitivePeerDependencies:
- supports-color
- typescript
dev: false
- /vite@5.4.6(@types/node@20.10.5):
- resolution: {integrity: sha512-IeL5f8OO5nylsgzd9tq4qD2QqI0k2CQLGrWD0rCN0EQJZpBK5vJAx0I+GDkMOXxQX/OfFHMuLIx6ddAxGX/k+Q==}
+ /vite@5.4.11(@types/node@20.10.5):
+ resolution: {integrity: sha512-c7jFQRklXua0mTzneGW9QVyxFjUgwcihC4bXEtujIo2ouWCe1Ajt/amn2PCxYnhYfd5k09JX3SB7OYWFKYqj8Q==}
engines: {node: ^18.0.0 || >=20.0.0}
hasBin: true
peerDependencies:
@@ -14707,7 +14707,7 @@ packages:
strip-literal: 1.3.0
tinybench: 2.5.1
tinypool: 0.7.0
- vite: 5.4.6(@types/node@20.10.5)
+ vite: 5.4.11(@types/node@20.10.5)
vite-node: 0.34.6(@types/node@20.10.5)
why-is-node-running: 2.2.2
transitivePeerDependencies:
diff --git a/ngui/ui/src/components/PowerSchedules/PowerSchedules.tsx b/ngui/ui/src/components/PowerSchedules/PowerSchedules.tsx
index 51c7dd654..08b039073 100644
--- a/ngui/ui/src/components/PowerSchedules/PowerSchedules.tsx
+++ b/ngui/ui/src/components/PowerSchedules/PowerSchedules.tsx
@@ -47,20 +47,7 @@ const PowerSchedules = ({
const actionBarDefinition = {
title: {
messageId: "powerSchedulesTitle"
- },
- items: [
- {
- key: "btn-add",
- dataTestId: "btn_add",
- icon: ,
- messageId: "add",
- color: "success",
- variant: "contained",
- type: "button",
- requiredActions: ["EDIT_PARTNER"],
- action: () => navigate(CREATE_POWER_SCHEDULE)
- }
- ]
+ }
};
const tableData = useMemo(() => powerSchedules, [powerSchedules]);
@@ -169,7 +156,34 @@ const PowerSchedules = ({
<>
- {isGetPowerSchedulesLoading ? : }
+ {isGetPowerSchedulesLoading ? (
+
+ ) : (
+ ,
+ messageId: "add",
+ color: "success",
+ variant: "contained",
+ type: "button",
+ requiredActions: ["EDIT_PARTNER"],
+ action: () => navigate(CREATE_POWER_SCHEDULE)
+ }
+ ]
+ }
+ }}
+ pageSize={50}
+ />
+ )}
>
);
diff --git a/rest_api/rest_api_server/controllers/available_filters.py b/rest_api/rest_api_server/controllers/available_filters.py
index c65b66ffa..c2d363955 100644
--- a/rest_api/rest_api_server/controllers/available_filters.py
+++ b/rest_api/rest_api_server/controllers/available_filters.py
@@ -1,6 +1,11 @@
import logging
from collections import defaultdict
-from rest_api.rest_api_server.controllers.base_async import BaseAsyncControllerWrapper
+from tools.optscale_exceptions.common_exc import (
+ FailedDependency
+)
+from rest_api.rest_api_server.controllers.base_async import (
+ BaseAsyncControllerWrapper
+)
from rest_api.rest_api_server.controllers.expense import CleanExpenseController
from rest_api.rest_api_server.utils import encode_string, get_nil_uuid
@@ -241,6 +246,13 @@ def _aggregate_resource_data(self, match_query, **kwargs):
{'$group': group_stage}
], allowDiskUse=True)
+ def get(self, organization_id, **params):
+ try:
+ self.get_organization_and_cloud_accs(organization_id)
+ except FailedDependency:
+ return self._get_base_result({})
+ return super().get(organization_id, **params)
+
class AvailableFiltersAsyncController(BaseAsyncControllerWrapper):
diff --git a/rest_api/rest_api_server/handlers/v2/available_filters.py b/rest_api/rest_api_server/handlers/v2/available_filters.py
index af88fcaae..8ab653ac2 100644
--- a/rest_api/rest_api_server/handlers/v2/available_filters.py
+++ b/rest_api/rest_api_server/handlers/v2/available_filters.py
@@ -463,10 +463,6 @@ async def get(self, organization_id, **url_params):
description: |
Not found:
- OE0002: Organization not found
- 424:
- description: |
- Failed dependency:
- - OE0445: Organization doesn't have any cloud accounts connected
security:
- token: []
- secret: []
diff --git a/rest_api/rest_api_server/tests/unittests/test_available_filters.py b/rest_api/rest_api_server/tests/unittests/test_available_filters.py
index 0046d489c..eb7606526 100644
--- a/rest_api/rest_api_server/tests/unittests/test_available_filters.py
+++ b/rest_api/rest_api_server/tests/unittests/test_available_filters.py
@@ -101,8 +101,7 @@ def test_available_filters_limit(self):
self.assertEqual(response['error']['error_code'], 'OE0212')
def test_invalid_organization(self):
- day_in_month = datetime(2020, 1, 14)
-
+ day_in_month = datetime(2020, 1, 14, tzinfo=timezone.utc)
time = int(day_in_month.timestamp())
valid_aws_cloud_acc = {
'name': 'my cloud_acc',
@@ -118,6 +117,12 @@ def test_invalid_organization(self):
self.assertEqual(code, 201)
_, organization2 = self.client.organization_create(
{'name': "organization2"})
+ _, employee2 = self.client.employee_create(
+ organization2['id'],
+ {'name': 'name2', 'auth_user_id': self.auth_user_id_1})
+ code, cloud_acc2 = self.create_cloud_account(
+ organization2['id'], valid_aws_cloud_acc)
+ self.assertEqual(code, 201)
filters = {
'cloud_account_id': [cloud_acc1['id']]
}
@@ -150,3 +155,13 @@ def test_available_filters_default_values_if_filtered_by_entity(self):
self.org_id, min_timestamp, max_timestamp, filters)
self.assertEqual(code, 200)
self.assertEqual(response['filter_values']['pool'], [])
+
+ def test_available_filters_no_cloud_account(self):
+ _, org = self.client.organization_create(
+ {'name': "organization1"})
+ max_timestamp = int(datetime.max.replace(
+ tzinfo=timezone.utc).timestamp()) - 1
+ code, response = self.client.available_filters_get(
+ org['id'], 0, max_timestamp, {})
+ self.assertEqual(code, 200)
+ self.assertEqual(response['filter_values'], {})
diff --git a/tools/cloud_adapter/clouds/aws.py b/tools/cloud_adapter/clouds/aws.py
index 6d4f30bf5..0b6a8b282 100644
--- a/tools/cloud_adapter/clouds/aws.py
+++ b/tools/cloud_adapter/clouds/aws.py
@@ -278,6 +278,8 @@ def discover_region_instances(self, region):
next_token = described.get('NextToken')
for reservation in described['Reservations']:
for instance in reservation['Instances']:
+ sg_ids = [x['GroupId'] for x in instance.get(
+ 'SecurityGroups', [])]
dates = [x['Ebs']['AttachTime'] for x in instance[
'BlockDeviceMappings'] if 'Ebs' in x]
dates.extend(list(map(
@@ -293,7 +295,7 @@ def discover_region_instances(self, region):
region=region,
name=self._extract_tag(instance, 'Name'),
flavor=instance['InstanceType'],
- security_groups=instance.get('SecurityGroups', []),
+ security_groups=sg_ids,
organization_id=self.organization_id,
tags=self._extract_tags(instance),
spotted=spotted,