Skip to content

Commit db99d24

Browse files
committed
bug fixes + schema enrichment across 34 files
- Fix audit field lookups (camelCase → snake_case; all rows were NULL) - Fix enum_comp list_compartments unguarded 401 on two code paths - Fix FileStorage per-AD list calls to continue on ServiceError instead of aborting - Add source/target/tasks to sch_service_connectors; get-enriched data no longer silently dropped - Expand DB schema + COLUMNS for bds_instances, container_instances, desktops_pools, dataflow_applications, dataflow_runs, goldengate_deployments, ocvp_sddcs/clusters, opensearch_clusters — get-only fields (credentials, network topology, runtime config) now persisted when --get is used - Misc module fixes: cloudguard pagination, vault, networkfirewall, exploit RPST modules, parallel pool, exports, session/db cleanup
1 parent 4a3c30d commit db99d24

34 files changed

Lines changed: 505 additions & 123 deletions

File tree

ocinferno/cli/main.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,6 @@ def main() -> None:
346346
if not workspaces:
347347
print("[*] No workspaces detected. Please create your first workspace.")
348348
name, workspace_id = prompt_new_workspace(dc)
349-
dc.close()
350349
workspace_instructions(
351350
workspace_id,
352351
name,

ocinferno/cli/workspace_instructions.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,8 @@ def readline_complete(self, text: str, state: int):
335335
return None
336336

337337
def process_command(self, command: str):
338+
if not command.strip():
339+
return None
338340
try:
339341
args = self.parser.parse_args(shlex.split(command))
340342
cmd = args.subcommand
@@ -604,7 +606,7 @@ def label_of(cid):
604606
def add_compartment(self, cid: str) -> None:
605607
if not cid:
606608
return
607-
existing = [comp.get("compartment_id") for comp in self.session.global_compartment_list if isinstance(comp, dict)]
609+
existing = [comp.get("compartment_id") or comp.get("id") for comp in self.session.global_compartment_list if isinstance(comp, dict)]
608610
if cid in existing:
609611
print(f"{UtilityTools.RED}{UtilityTools.BOLD}[X] {cid} already exists in the list.{UtilityTools.RESET}")
610612
return
@@ -614,7 +616,7 @@ def add_compartment(self, cid: str) -> None:
614616
def set_current_compartment(self, cid: str) -> None:
615617
if not cid:
616618
return
617-
existing = [comp.get("compartment_id") for comp in self.session.global_compartment_list if isinstance(comp, dict)]
619+
existing = [comp.get("compartment_id") or comp.get("id") for comp in self.session.global_compartment_list if isinstance(comp, dict)]
618620
if cid not in existing:
619621
print(f"[!] {cid} not in known list. Adding...")
620622
self.session.add_cid(cid)

ocinferno/core/db.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -651,14 +651,12 @@ def run_sql_query(self, db: str, query: str, *, max_rows: int = 200) -> Dict[str
651651
break
652652
for row in chunk:
653653
total += 1
654-
row_dict = {c: self._sql_output_cell(row[c]) for c in columns}
655-
if len(rows) < max_rows:
656-
rows.append(row_dict)
657-
else:
658-
truncated = True
659-
break
660-
if truncated:
661-
break
654+
if not truncated:
655+
row_dict = {c: self._sql_output_cell(row[c]) for c in columns}
656+
if len(rows) < max_rows:
657+
rows.append(row_dict)
658+
else:
659+
truncated = True
662660

663661
return {
664662
"query_type": "select",
@@ -1285,12 +1283,16 @@ def save_dict_rows_bulk(
12851283
else:
12861284
sql = f'INSERT OR REPLACE INTO "{table_name}" ({col_list}) VALUES ({placeholders})'
12871285

1286+
in_txn = conn.in_transaction
12881287
try:
12891288
cursor.executemany(sql, values_list)
1290-
conn.commit()
1289+
if not in_txn:
1290+
conn.commit()
12911291
return len(rows)
12921292
except Exception as e:
12931293
print(f"[X] Bulk save failed into '{table_name}': {e}")
1294+
if in_txn:
1295+
raise
12941296
try:
12951297
conn.rollback()
12961298
except Exception:

ocinferno/core/session.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,6 @@ def _record_event(**event_kwargs):
319319
attempt = 1
320320
while True:
321321
t0 = time.time()
322-
if owner:
323-
owner._wait_for_http_rate_limit()
324322
try:
325323
resp = original_call_api(base_client_self, *args, **kwargs)
326324
status_code = int(getattr(resp, "status", 0) or 0)

ocinferno/core/utils/exports.py

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -734,17 +734,19 @@ def _build_condensed_record(db_info: Dict[str, Any], table_name: str, rd: Dict[s
734734
for db in db_infos:
735735
for table in db["tables"]:
736736
table_name = str(table["name"])
737-
title = _excel_sheet_title(f'{db["name"]}_{table_name}', used_titles)
738737
table_rows = list((db.get("rows_by_table") or {}).get(table_name) or [])
739738
records = [_build_condensed_record(db, table_name, rd) for rd in table_rows]
740739
exported_rows += len(records)
741-
pd.DataFrame(records, columns=condensed_header).to_excel(
742-
writer, sheet_name=title, index=False
743-
)
744-
_apply_xlsx_condensed_layout(
740+
_write_records_chunked(
741+
pd=pd,
745742
writer=writer,
746-
sheet_name=title,
747-
data_row_count=len(records),
743+
records=records,
744+
columns=condensed_header,
745+
base_sheet_name=f'{db["name"]}_{table_name}',
746+
used_titles=used_titles,
747+
apply_layout=lambda title, count: _apply_xlsx_condensed_layout(
748+
writer=writer, sheet_name=title, data_row_count=count
749+
),
748750
)
749751
if not used_titles:
750752
sheet_name = "all_resources"
@@ -780,7 +782,6 @@ def _build_condensed_record(db_info: Dict[str, Any], table_name: str, rd: Dict[s
780782
for table in db["tables"]:
781783
table_name = str(table["name"])
782784
cols = list(table["columns"] or [])
783-
title = _excel_sheet_title(f'{db["name"]}_{table_name}', used_titles)
784785
table_rows = list((db.get("rows_by_table") or {}).get(table_name) or [])
785786
records: List[Dict[str, Any]] = []
786787
for rd in table_rows:
@@ -789,8 +790,13 @@ def _build_condensed_record(db_info: Dict[str, Any], table_name: str, rd: Dict[s
789790
row_obj[c] = _excel_safe_value(rd.get(c))
790791
records.append(row_obj)
791792
exported_rows += len(records)
792-
pd.DataFrame(records, columns=["Database", "resource"] + cols).to_excel(
793-
writer, sheet_name=title, index=False
793+
_write_records_chunked(
794+
pd=pd,
795+
writer=writer,
796+
records=records,
797+
columns=["Database", "resource"] + cols,
798+
base_sheet_name=f'{db["name"]}_{table_name}',
799+
used_titles=used_titles,
794800
)
795801
if not used_titles:
796802
pd.DataFrame(columns=["Database", "resource"]).to_excel(

ocinferno/core/utils/parallel.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,16 @@ def _should_emit(completed: int) -> bool:
7979
worker_count = min(parsed_threads, 32, len(entries))
8080

8181
if worker_count <= 1:
82-
output = []
82+
output: List[Any] = []
8383
for idx, item in enumerate(entries, start=1):
8484
if cancel_requested():
8585
break
8686
output.append(worker(item))
8787
if show_progress and _should_emit(idx):
8888
print(f"[*] {label}: {idx}/{total} completed (last={_progress_token(item)})")
89+
# Pad with None to match the parallel path's shape (same length as input).
90+
while len(output) < len(entries):
91+
output.append(None)
8992
return output
9093

9194
results: List[Any] = [None] * len(entries)

ocinferno/mappings/database_info.json

Lines changed: 109 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2990,7 +2990,14 @@
29902990
"freeform_tags",
29912991
"id",
29922992
"lifecycle_state",
2993-
"time_created"
2993+
"time_created",
2994+
"vnics",
2995+
"volumes",
2996+
"dns_config",
2997+
"image_pull_secrets",
2998+
"shape",
2999+
"shape_config",
3000+
"graceful_shutdown_timeout_in_seconds"
29943001
],
29953002
"primary_keys": [
29963003
"id"
@@ -3006,7 +3013,20 @@
30063013
"id",
30073014
"lifecycle_state",
30083015
"time_created",
3009-
"time_updated"
3016+
"time_updated",
3017+
"file_uri",
3018+
"archive_uri",
3019+
"class_name",
3020+
"language",
3021+
"driver_shape",
3022+
"executor_shape",
3023+
"num_executors",
3024+
"logs_bucket_uri",
3025+
"warehouse_bucket_uri",
3026+
"private_endpoint_id",
3027+
"arguments",
3028+
"parameters",
3029+
"configuration"
30103030
],
30113031
"primary_keys": [
30123032
"id"
@@ -3021,7 +3041,26 @@
30213041
"freeform_tags",
30223042
"id",
30233043
"lifecycle_state",
3024-
"time_created"
3044+
"time_created",
3045+
"time_updated",
3046+
"application_id",
3047+
"file_uri",
3048+
"class_name",
3049+
"language",
3050+
"driver_shape",
3051+
"executor_shape",
3052+
"num_executors",
3053+
"logs_bucket_uri",
3054+
"warehouse_bucket_uri",
3055+
"private_endpoint_id",
3056+
"run_duration_in_milliseconds",
3057+
"data_read_in_bytes",
3058+
"data_written_in_bytes",
3059+
"owner_principal_id",
3060+
"private_endpoint_subnet_id",
3061+
"arguments",
3062+
"parameters",
3063+
"configuration"
30253064
],
30263065
"primary_keys": [
30273066
"id"
@@ -3439,7 +3478,23 @@
34393478
"time_created",
34403479
"time_updated",
34413480
"freeform_tags",
3442-
"defined_tags"
3481+
"defined_tags",
3482+
"shape_name",
3483+
"image",
3484+
"network_configuration",
3485+
"nsg_ids",
3486+
"availability_domain",
3487+
"are_privileged_users",
3488+
"device_policy",
3489+
"availability_policy",
3490+
"boot_volume_size_in_gbs",
3491+
"is_storage_enabled",
3492+
"private_access_details",
3493+
"standby_size",
3494+
"storage_size_in_gbs",
3495+
"storage_backup_policy_id",
3496+
"time_start_scheduled",
3497+
"time_stop_scheduled"
34433498
],
34443499
"primary_keys": [
34453500
"id"
@@ -3678,7 +3733,10 @@
36783733
"lifecycle_details",
36793734
"freeform_tags",
36803735
"defined_tags",
3681-
"system_tags"
3736+
"system_tags",
3737+
"source",
3738+
"target",
3739+
"tasks"
36823740
],
36833741
"primary_keys": [
36843742
"id"
@@ -4357,7 +4415,15 @@
43574415
"subnet_id",
43584416
"fqdn",
43594417
"license_model",
4360-
"ogg_data"
4418+
"ogg_data",
4419+
"nsg_ids",
4420+
"ingress_ips",
4421+
"availability_domain",
4422+
"is_healthy",
4423+
"maintenance_window",
4424+
"maintenance_configuration",
4425+
"time_of_next_maintenance",
4426+
"next_maintenance_action_type"
43614427
],
43624428
"primary_keys": [
43634429
"id"
@@ -4537,7 +4603,20 @@
45374603
"vcn_id",
45384604
"total_storage_gb",
45394605
"software_version",
4540-
"data_node_count"
4606+
"data_node_count",
4607+
"security_master_user_name",
4608+
"security_master_user_password_hash",
4609+
"fqdn",
4610+
"nsg_id",
4611+
"data_node_host_type",
4612+
"data_node_host_ocpu_count",
4613+
"data_node_host_memory_gb",
4614+
"data_node_storage_gb",
4615+
"master_node_count",
4616+
"master_node_host_type",
4617+
"coordinator_node_count",
4618+
"opendashboard_node_count",
4619+
"opendashboard_private_ip"
45414620
],
45424621
"primary_keys": [
45434622
"id"
@@ -4630,7 +4709,15 @@
46304709
"is_secure",
46314710
"is_cloud_sql_configured",
46324711
"is_kafka_configured",
4633-
"cluster_profile"
4712+
"cluster_profile",
4713+
"network_config",
4714+
"kms_key_id",
4715+
"secret_id",
4716+
"bootstrap_script_url",
4717+
"cloud_sql_details",
4718+
"cluster_details",
4719+
"created_by",
4720+
"time_updated"
46344721
],
46354722
"primary_keys": [
46364723
"id"
@@ -5655,7 +5742,14 @@
56555742
"hcx_fqdn",
56565743
"vmware_software_version",
56575744
"clusters_count",
5658-
"is_single_host_sddc"
5745+
"is_single_host_sddc",
5746+
"ssh_authorized_keys",
5747+
"vcenter_username",
5748+
"nsx_manager_username",
5749+
"esxi_software_version",
5750+
"nsx_manager_private_ip_id",
5751+
"vcenter_private_ip_id",
5752+
"hcx_private_ip_id"
56595753
],
56605754
"primary_keys": [
56615755
"id"
@@ -5692,7 +5786,12 @@
56925786
"esxi_hosts_count",
56935787
"initial_host_shape_name",
56945788
"is_shielded_instance_enabled",
5695-
"vsphere_type"
5789+
"vsphere_type",
5790+
"network_configuration",
5791+
"ssh_authorized_keys",
5792+
"workload_network_cidr",
5793+
"esxi_software_version",
5794+
"initial_commitment"
56965795
],
56975796
"primary_keys": [
56985797
"id"

ocinferno/modules/audit/utilities/helpers.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,17 @@ def list(self, *, compartment_id: str, start_time: datetime, end_time: datetime)
5656
identity = data.get("identity") or {}
5757
request = data.get("request") or {}
5858
rows.append({
59-
"event_id": data.get("eventId"),
60-
"event_time": data.get("eventTime") or envelope.get("eventTime"),
61-
"event_name": data.get("eventName"),
62-
"event_type": envelope.get("eventType"),
63-
"principal_name": identity.get("principalName"),
64-
"principal_id": identity.get("principalId"),
65-
"source_ip": identity.get("ipAddress"),
66-
"user_agent": identity.get("userAgent"),
59+
"event_id": envelope.get("event_id"),
60+
"event_time": envelope.get("event_time"),
61+
"event_name": data.get("event_name"),
62+
"event_type": envelope.get("event_type"),
63+
"principal_name": identity.get("principal_name"),
64+
"principal_id": identity.get("principal_id"),
65+
"source_ip": identity.get("ip_address"),
66+
"user_agent": identity.get("user_agent"),
6767
"request_action": request.get("action"),
68-
"resource_name": data.get("resourceName"),
69-
"compartment_id": data.get("compartmentId") or compartment_id,
68+
"resource_name": data.get("resource_name"),
69+
"compartment_id": data.get("compartment_id") or compartment_id,
7070
})
7171
return rows
7272

ocinferno/modules/bds/utilities/helpers.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,12 @@ class BdsInstancesResource(OciListResource):
2626
"is_cloud_sql_configured",
2727
"is_kafka_configured",
2828
"cluster_profile",
29+
"network_config",
30+
"kms_key_id",
31+
"secret_id",
32+
"bootstrap_script_url",
33+
"cloud_sql_details",
34+
"cluster_details",
35+
"created_by",
36+
"time_updated",
2937
]

0 commit comments

Comments
 (0)