DevOpsHiveHQ / kubech

Set kubectl context/namespace per shell/terminal to manage multi Kubernetes clusters at the same time (it's parallel kubectx/kubens)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

find: -printf: unknown primary or operator

ibexmonj opened this issue · comments

Firstly, thank you for writing this and making this widely available. This is a boon for managing multiple clusters.

The installation steps as described in the documentation worked just fine.

I can use kubech just fine and kubechc lets we switch the clusters just fine as well. Everytime i switch context in a new terminal i see the below message.

find: -printf: unknown primary or operator
find: -printf: unknown primary or operator

My workstation is Intel Mac OS.

Not sure about the cause of this and if its a me problem. Have you run into this by any chance ?

haven't had a chance to dig deep into patching this in a way that'll work on linux but on mac brew install findutils and patch kubech with the following

index d5a918c..d26eb61 100644
--- a/kubech
+++ b/kubech
@@ -54,7 +54,7 @@ chmod 744 "${KUBECONFIG_SRC_DIR}" "${KUBECONFIG_DEST_DIR}"
 # Handeling Kube config files.
 _kubeconfig_files () {
     if [ -d "${KUBECONFIG_SRC_DIR}" ]; then
-        KUBECONFIG_FILES="$(find "${KUBECONFIG_SRC_DIR}" -type f -printf '%p:')"
+        KUBECONFIG_FILES="$(gfind "${KUBECONFIG_SRC_DIR}" -type f -printf '%p:')"
     fi
     echo "${KUBECONFIG_FILES}${KUBECONFIG_ORIG}"
 }```

due to the following
https://unix.stackexchange.com/questions/272491/bash-error-find-printf-unknown-primary-or-operator

Ah, looks like macOS doesn't have GNU find.

Do you have the printf command? It would be easy to use it with ls to get the same results.

You can also

brew install findutils

And add this to your shell RC file

alias find=gfind

To not have to patch kubech. That will globally replace macOS' default /usr/bin/find with gfind.

that would potentially cause issue with things expecting BSD find on your system

fixed by #8