Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions flex-linux-setup/flex_linux_setup/flex_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ def __init__(self):
self.templates_dir = os.path.join(self.flex_setup_dir, 'templates')
self.admin_ui_config_properties_path = os.path.join(self.templates_dir, 'auiConfiguration.json')
self.adimin_ui_bin_url = 'https://jenkins.gluu.org/npm/admin_ui/main/built/admin-ui-main-built.tar.gz'
self.policy_store_path = os.path.join(self.templates_dir, 'policy-store.json')

if not argsp.download_exit:
self.dbUtils.bind(force=True)
Expand Down Expand Up @@ -567,6 +568,15 @@ def install_gluu_admin_ui(self):

self.install_config_api_plugin()

#cedarling integration
admin_ui_config_dir = os.path.join(config_api_installer.custom_config_dir, 'adminUI')
config_api_installer.renderTemplateInOut(self.policy_store_path, self.templates_dir, admin_ui_config_dir)
config_api_installer.chown(admin_ui_config_dir, Config.jetty_user, Config.jetty_group)
resource_scopes_mapping_lidf_fn = os.path.join(self.templates_dir, 'adminUIResourceScopesMapping.ldif')

self.dbUtils.import_ldif([resource_scopes_mapping_lidf_fn])
Comment on lines +575 to +577
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Fix variable naming and add file existence check.

Two issues:

  1. Line 575: Variable name resource_scopes_mapping_lidf_fn contains a typo—should be ldif_fn (LDAP Data Interchange Format, not "lidf").
  2. Line 577: No check if the LDIF file exists before importing, which could cause a runtime error if the file is missing.

Apply this diff:

-        resource_scopes_mapping_lidf_fn = os.path.join(self.templates_dir, 'adminUIResourceScopesMapping.ldif')
+        resource_scopes_mapping_ldif_fn = os.path.join(self.templates_dir, 'adminUIResourceScopesMapping.ldif')
 
-        self.dbUtils.import_ldif([resource_scopes_mapping_lidf_fn])
+        if os.path.exists(resource_scopes_mapping_ldif_fn):
+            self.dbUtils.import_ldif([resource_scopes_mapping_ldif_fn])
+        else:
+            print(f"Warning: LDIF file not found: {resource_scopes_mapping_ldif_fn}")
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
resource_scopes_mapping_lidf_fn = os.path.join(self.templates_dir, 'adminUIResourceScopesMapping.ldif')
self.dbUtils.import_ldif([resource_scopes_mapping_lidf_fn])
resource_scopes_mapping_ldif_fn = os.path.join(self.templates_dir, 'adminUIResourceScopesMapping.ldif')
if os.path.exists(resource_scopes_mapping_ldif_fn):
self.dbUtils.import_ldif([resource_scopes_mapping_ldif_fn])
else:
print(f"Warning: LDIF file not found: {resource_scopes_mapping_ldif_fn}")
🤖 Prompt for AI Agents
In flex-linux-setup/flex_linux_setup/flex_setup.py around lines 575 to 577, the
variable name resource_scopes_mapping_lidf_fn has a typo (should be ldif_fn) and
there is no check that the LDIF file exists before importing; rename the
variable to resource_scopes_mapping_ldif_fn and before calling
self.dbUtils.import_ldif(...) verify the file exists with
os.path.exists(resource_scopes_mapping_ldif_fn) (or os.path.isfile) and handle
the missing file by logging an error and exiting or raising an exception so
import_ldif is only called with a valid path.



print("Removing DUO Script")
config_api_installer.dbUtils.delete_dn('inum=5018-F9CF,ou=scripts,o=jans')

Expand Down
Loading
Loading