SAP / cf-html5-apps-repo-cli-plugin

Cloud Foundry CLI plugin to work with SAP Cloud HTML5 Applications Repository
Apache License 2.0
43 stars 5 forks source link

Deleting with sap_cloud_service name with * not working #36

Open LalithManokar opened 4 years ago

LalithManokar commented 4 years ago

Description

I have deployed the application using cf html5-push then i try to delete using

cf html5-delete -d -n <sap_cloud_service_name>*

it is not getting deleted. if i use the app_host_name instead of sap_cloud_service_name* then it is getting deleted and xsuaa is not getting deleted. version 1.4.3

Environment

canary business application studio

CLI Output

user: projects $ cf html5-delete -d -n heliummd*
08:42:07.854971 Initializing command 'html5-delete'
08:42:07.855025 Configuration file does not exist. No cache to crear
08:42:07.855032 Executing command 'html5-delete': args: '[-d -n heliummd]'
08:42:07.855050 Deleting service instances by IDs: []
08:42:07.855056 Getting context (org/space/username)
08:42:07.856086 Resolving app-host-id by service instance name 'heliummd'
08:42:07.856104 Making request to: /v2/service_instances?q=name:heliummd&q=space_guid:895719b1-fdff-4828-9a5c-884f9544db16
FAILED
Could not get service instance by name: Service instance with name 'heliummd' not found
user: projects $ cf html5-delete -d -n heliummd-app-host-1591686826 
08:45:04.329308 Initializing command 'html5-delete'
08:45:04.329383 Configuration file does not exist. No cache to crear
08:45:04.329394 Executing command 'html5-delete': args: '[-d -n heliummd-app-host-1591686826]'
08:45:04.329423 Deleting service instances by IDs: []
08:45:04.329433 Getting context (org/space/username)
08:45:04.330859 Resolving app-host-id by service instance name 'heliummd-app-host-1591686826'
08:45:04.330882 Making request to: /v2/service_instances?q=name:heliummd-app-host-1591686826&q=space_guid:895719b1-fdff-4828-9a5c-884f9544db16
08:45:04.739378 Resolved app-host-id is '07f938e1-67fc-4c34-914c-192d35b8d8b3'
Deleting service instances with IDs 07f938e1-67fc-4c34-914c-192d35b8d8b3 and associated destinations in org heliumdemosp / space helium as I307469...
08:45:04.739429 Getting destination service context
08:45:04.739438 Getting list of services
08:45:04.739904 Making request to: /v2/spaces/895719b1-fdff-4828-9a5c-884f9544db16/services
08:45:05.630952 Looking for 'destination' service
08:45:05.630970 Destination service found: &{Name:destination GUID:be381e3b-0d69-47bc-a044-63f69733acfe}
08:45:05.630992 Getting service plans for 'destination' service (GUID: be381e3b-0d69-47bc-a044-63f69733acfe)
08:45:05.631010 Making request to: /v2/service_plans?q=service_guid:be381e3b-0d69-47bc-a044-63f69733acfe
08:45:06.092344 Destination service 'lite' plan found: &{Name:lite GUID:821497d5-8d07-4748-bf78-48495eec823b}
08:45:06.092440 Getting service instances of 'destination' service 'lite' plan (&{Name:lite GUID:821497d5-8d07-4748-bf78-48495eec823b})
08:45:06.092452 Making request to: /v2/service_instances?q=service_plan_guid%20IN%20821497d5-8d07-4748-bf78-48495eec823b%3Bspace_guid:895719b1-fdff-4828-9a5c-884f9544db16
08:45:06.320341 Using service instance of 'destination' service 'lite' plan: {Name:heliumdemo-destination-service GUID:9fdb8dcb-92e8-4c69-86d3-7a6e7efa8853 UpdatedAt:2020-06-09T07:09:16Z LastOperation:{Type:create State:succeeded Description: UpdatedAt:2020-06-09T07:09:16Z CreatedAt:2020-06-09T07:09:16Z}}
08:45:06.320391 Creating service key for 'destination' service 'lite' plan
08:45:06.320400 Making request to: /v2/service_keys
08:45:07.937236 Getting token for service key html5-key-1591692306
08:45:07.937255 Making request to: https://heliumdemo.authentication.sap.hana.ondemand.com/oauth/token
08:45:08.210156 Access token for service key html5-key-1591692306: [HIDDEN PRIVATE DATA]
08:45:08.210188 Making request to: https://destination-configuration.cfapps.sap.hana.ondemand.com/destination-configuration/v1/subaccountDestinations/
08:45:08.285988 Deleting destination 'heliummd'
08:45:08.286012 Making request to: https://destination-configuration.cfapps.sap.hana.ondemand.com/destination-configuration/v1/subaccountDestinations/heliummd
08:45:08.319919 Adding sap.cloud.service 'helium.md' to the deletion list
08:45:08.319944 Deleting destination 'heliummd' with sap.cloud.service 'helium.md'
08:45:08.319954 Making request to: https://destination-configuration.cfapps.sap.hana.ondemand.com/destination-configuration/v1/subaccountDestinations/heliummd
08:45:08.340335 Deleting service key html5-key-1591692306
08:45:08.340358 Making request to (try 1/3): /v2/service_keys/1ec73273-f5e7-494b-b5ae-5ce37a09e177
08:45:08.782470 Getting list of service keys for app-host-id 07f938e1-67fc-4c34-914c-192d35b8d8b3
08:45:08.782494 Making request to: /v2/service_instances/07f938e1-67fc-4c34-914c-192d35b8d8b3/service_keys
08:45:08.910627 Deleting service instance 07f938e1-67fc-4c34-914c-192d35b8d8b3
08:45:08.910675 Making request to (try 1/3): /v2/service_instances/07f938e1-67fc-4c34-914c-192d35b8d8b3?recursive=true
OK

08:45:13.112229 Disposing command 'html5-delete'
user: projects $ 
micellius commented 4 years ago

@lalithmanokar , thanks for reporting an issue!

I analysed the log that you attached and it looks like the shell that you are using interprets the * as a special character and not passes it to CLI

08:42:07.855032 Executing command 'html5-delete': args: '[-d -n heliummd]' 08:42:07.855050 Deleting service instances by IDs: [] 08:42:07.855056 Getting context (org/space/username) 08:42:07.856086 Resolving app-host-id by service instance name 'heliummd'

As you can see in the first log line above, there is no * after heliummd before ]. Therefore, CLI is looking for exact match of service instance name heliummd.

You should try to put the argument that contains * into quotes to avoid shell from interpreting it

cf html5-delete -d -n 'heliummd-*'

Depending on OS and shell different type of quotes may be required: either ' or "

LalithManokar commented 4 years ago

hi this worked for the application is deployed via cf html5-push option. but application deployed via mtar is still not happening.

Regards, Lalith. S

micellius commented 3 years ago

@lalithmanokar , can you please paste the list of service names from cf s and the debug logs of the command, when you run it with DEBUG=1. What exactly is not deleted: service instance or destination? Or the command fails?