Browse Source

HUE-3023 [aws] Perform check config only if configured

Romain Rigaux 10 năm trước cách đây
mục cha
commit
8a0499f
1 tập tin đã thay đổi với 9 bổ sung9 xóa
  1. 9 9
      desktop/libs/aws/src/aws/conf.py

+ 9 - 9
desktop/libs/aws/src/aws/conf.py

@@ -55,16 +55,16 @@ AWS_ACCOUNTS = UnspecifiedConfigSection(
 def config_validator(user):
   res = []
 
-  if 'default' not in AWS_ACCOUNTS.keys():
-    res.append(('aws.aws_accounts', 'Default AWS account is not configured'))
+  if AWS_ACCOUNTS.keys():
+    if 'default' not in AWS_ACCOUNTS.keys():
+      res.append(('aws.aws_accounts', 'Default AWS account is not configured'))
 
-  regions = get_regions('s3')  # S3 is only supported service so far
-  region_names = [r.name for r in regions]
+    regions = get_regions('s3')  # S3 is only supported service so far
+    region_names = [r.name for r in regions]
 
-  for name in AWS_ACCOUNTS.keys():
-    region_name = AWS_ACCOUNTS[name].REGION.get()
-    if region_name not in region_names:
-      res.append(('aws.aws_accounts.%s.region' % name,
-                  'Unknown region %s' % region_name))
+    for name in AWS_ACCOUNTS.keys():
+      region_name = AWS_ACCOUNTS[name].REGION.get()
+      if region_name not in region_names:
+        res.append(('aws.aws_accounts.%s.region' % name, 'Unknown region %s' % region_name))
 
   return res