oracle / oci-cli

Command Line Interface for Oracle Cloud Infrastructure
https://cloud.oracle.com/cloud-infrastructure
Other
425 stars 176 forks source link

Error in command log-analytics storage purge-storage-data #818

Open kk-hiraskar opened 1 week ago

kk-hiraskar commented 1 week ago

I am purging logs using OCI CLI

oci log-analytics storage purge-storage-data     --compartment-id "$MONITORING_COMPARTMENT_OCID"    \
 --namespace-name "$TENANCY_NAME"     --purge-query-string "\"log group\"=\"${STACK_NAME}\""     \
 --time-data-ended "$(date +%Y-%m-%d -d '+1 day')"     --wait-for-state SUCCEEDED --wait-for-state FAILED \
 --wait-interval-seconds 10

This is purging logs, I can confirm it from web console, but however this command return error as,

Action completed. Waiting until the work request has entered state: ('SUCCEEDED', 'FAILED')
Encountered error while waiting for work request to enter the specified state. Outputting last known resource state
{
  "opc-work-request-id": "ocid1.loganalyticsstorageworkrequest.oc1.phx.amaaaaaaxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxwzndq"
}
TypeError: get_storage_work_request() missing 1 required positional argument: 'namespace_name'

due to this error, seems command is not waiting until mentioned logs are purged. And early exiting with error. However purge is happening.


I have verified namespace is provided correctly --namespace-name "$TENANCY_NAME" & this variable will not be blank, it is holding tenancy name, which is also same as object storage namespace.


This is web console, where purge requests are showing success.. and logs are purged also as per the query submitted. image

kk-hiraskar commented 1 week ago

is it a problem with? option is --namespace-name and inside code it is assigning with just -ns or --namespace

https://github.com/oracle/oci-cli/blob/d51c6bdb5d6336d7013ef9e53f4a2b25ec6b80d2/services/log_analytics/src/oci_cli_log_analytics/log_analytics_cli_extended.py#L15