Skip to content
This repository has been archived by the owner on Sep 7, 2022. It is now read-only.

K8S Vsphere Provider Automation Scripts lazy handling of indent from GOVC parsing #503

Open
james-powis opened this issue Aug 29, 2018 · 1 comment

Comments

@james-powis
Copy link

james-powis commented Aug 29, 2018

/kind bug

What happened: Automation script fails due to path spaces being removed

What you expected to happen: It should work...

How to reproduce it (as minimally and precisely as possible):
The vpc_daemon set produces the following logs:

++ govc vm.info -dc=ctec-ae-core -vm.uuid=422ef72c-6f09-4deb-f705-7f7de63deeb7
++ grep Path:
++ awk 'BEGIN {FS=":"};{print $2}'
++ tr -d ' '
+ vmpath=/ctec-ae-core/vm/Discoveredvirtualmachine/k8sm02
+ '[' -z /ctec-ae-core/vm/Discoveredvirtualmachine/k8sm02 ']'
+ govc vm.change -e=disk.enableUUID=1 -vm=/ctec-ae-core/vm/Discoveredvirtualmachine/k8sm02
+ '[' 1 -eq 0 ']'
+ ERROR_MSG='Failed to enable disk.enableUUID flag on the Node Virtual Machine'
+ update_VcpConfigStatus vcp-daementset-2v98f '[PHASE 2] Enable disk.enableUUID on the VM' FAILED 'Failed to enable disk.enableUUID flag on the Node Virtual Machine'
+ POD_NAME=vcp-daementset-2v98f
+ PHASE='[PHASE 2] Enable disk.enableUUID on the VM'
+ STATUS=FAILED
+ ERROR='Failed to enable disk.enableUUID flag on the Node Virtual Machine'

Manually stepping through the bash pipes produces the following.

$ govc vm.info -dc=ctec-ae-core -vm.uuid=422ef72c-6f09-4deb-f705-7f7de63deeb7 | grep Path: | awk 'BEGIN {FS=":"};{print $2}'
         /ctec-ae-core/vm/Discovered virtual machine/k8sm02

$ govc vm.info -dc=ctec-ae-core -vm.uuid=422ef72c-6f09-4deb-f705-7f7de63deeb7 | grep Path: | awk 'BEGIN {FS=":"};{print $2}' | tr -d ' '
/ctec-ae-core/vm/Discoveredvirtualmachine/k8sm02

Obviously the indent from govc needs to be removed, but the spaces in the actual path need to be preserved, and the result encapsulated in quotes.

@james-powis
Copy link
Author

The immediate work around is to manually move the nodes to the kubernetes folder created prior to the failing step. But given that "Discovered virtual machines" folder is the default for VSphere/VCenter this is pretty annoying.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant