I'm trying something, maybe it's not in the scope of the tool, it doesn't hurt to ask for help here. After running the below line:
scp [username]@[hostname]:~/.kube/config /dev/tty &> /dev/null | yq r - apiVersion
I'm getting this error, can I ask where I'm wrong?
main [ERRO] asked to process document index 0 but there are only 0 document(s)
the &> /dev/null before the pipe is redirecting both stdout and stderr to /dev/null, and so yq is getting an empty string as input
maybe you meant
scp [username]@[hostname]:~/.kube/config /dev/tty 2> /dev/null | yq r - apiVersion
?
@kmurphy4 you are right about stdout. I adjust the command to:
scp -q [username]@[hostname]:~/.kube/config /dev/tty 2> /dev/null | yq r - apiVersion
But yet not are running.
11:16:46 main [ERRO] asked to process document index 0 but there are only 0 document(s)
try it without the /dev/tty bit ... I think it's currently copying the file there and not directing anything to stdout
alternatively, you can probably change /dev/tty to /dev/stdout
Without /dev/tty not work. Take a look at the output just using /dev/tty:
$ brunowego@ally [~] scp -q [username]@[hostname]:~/.kube/config /dev/tty
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: [secret]
server: https://[hostname]:6443
name: kubernetes
contexts:
- context:
cluster: kubernetes
user: kubernetes-admin
name: kubernetes-admin@kubernetes
current-context: kubernetes-admin@kubernetes
kind: Config
preferences: {}
users:
- name: kubernetes-admin
user:
client-certificate-data: [secret]
client-key-data: [secret]
@kmurphy4 works!
scp -q [username]@[hostname]:~/.kube/config /dev/stdout | yq r - apiVersion
Most helpful comment
try it without the
/dev/ttybit ... I think it's currently copying the file there and not directing anything tostdoutalternatively, you can probably change
/dev/ttyto/dev/stdout