Skip to content

Instantly share code, notes, and snippets.

View eparis's full-sized avatar

Eric Paris eparis

  • Red Hat
  • Raleigh, NC
View GitHub Profile
@eparis
eparis / cmd.go
Created September 1, 2015 15:33
Program testing user defined --help flag and contextual information in help text
package main
import (
"fmt"
"github.com/spf13/cobra"
)
var _ = fmt.Print
@eparis
eparis / runerror.patch
Created August 30, 2015 16:04
cobra Run function with errors
diff --git a/command.go b/command.go
index cbbc326..9e4518f 100644
--- a/command.go
+++ b/command.go
@@ -70,6 +70,9 @@ type Command struct {
PreRun func(cmd *Command, args []string)
// Run: Typically the actual work function. Most commands will only implement this
Run func(cmd *Command, args []string)
+ // RunE: Typically the actual work function. Most commands will only implement this
+ // Same as Run but return an error. If both as set, RunE will be used

#Header With stuff right after

my link

#SOME OTHER HEADER ##WITH A SUBHEADER

Catched Error: Catched Error: SSH authentication failed! This is typically caused by the public/private
keypair for the SSH user not being properly set on the guest VM. Please
verify that the guest VM is setup with the proper public key, and that
the private key path for Vagrant is setup properly as well.
commit b42ed4183439c4c24639cff7398023e3355f9f42
Author: Eric Paris <eparis@redhat.com>
<10> ESTABLISH CONNECTION FOR USER: fedora
<10.0.0.1> ESTABLISH CONNECTION FOR USER: fedora
<10.0.0.1> REMOTE_MODULE slurp src=/etc/kubernetes/tokens/system:kubelet-kubernetes-vm-1.token
<10.0.0.1> REMOTE_MODULE slurp src=/etc/kubernetes/tokens/system:kubelet-kubernetes-vm-2.token
<10.0.0.1> EXEC ssh -C -tt -vvv -o UserKnownHostsFile=/dev/null -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/home/eparis/.ansible/cp/ansible-ssh-%h-%p-%r" -o StrictHostKeyChecking=no -o Port=22 -o IdentityFile="/home/eparis/.ssh/id_rsa" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=fedora -o ConnectTimeout=10 10.0.0.1 /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1436476255.52-221396387295805 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1436476255.52-221396387295805 && echo $HOME/.ansible/tmp/ansible-tmp-1436476255.52-221396387295805'
<10.0.0.1> EXEC ssh -C -tt -vvv -o UserKnownHostsFile=/dev/null -o ControlMa
@eparis
eparis / gist:8c641ee61749814e75c4
Created July 5, 2015 04:07
Potential fix for certs and inventories which use DNS names instead of IPs
diff --git a/contrib/ansible/roles/kubernetes/files/make-ca-cert.sh b/contrib/ansible/roles/kubernetes/files/make-ca-cert.sh
index 3950eec..7ae6305 100755
--- a/contrib/ansible/roles/kubernetes/files/make-ca-cert.sh
+++ b/contrib/ansible/roles/kubernetes/files/make-ca-cert.sh
@@ -20,9 +20,9 @@ set -o pipefail
# Caller should set in the ev:
# MASTER_IP - this may be an ip or things like "_use_gce_external_ip_"
+# MASTER_NAME - DNS name for the master
# DNS_DOMAIN - which will be passed to minions in --cluster_domain
This file has been truncated, but you can view the full file.
KUBECONFIG=~/kubectl.kubeconfig KUBE_MASTER_IP=10.12.7.55 hack/conformance-test.sh
Conformance test using /home/eparis/kubectl.kubeconfig against master at 10.12.7.55
Conformance test run date:Wed Jul 1 13:55:16 EDT 2015
Conformance test SHA:3094c1624ba790c9f0c18ad80d0e5a4e0fb5107f
Conformance test version tag(s):
Conformance test checking conformance with Kubernetes version 1.0
Conformance test: not doing test setup.
I0701 13:55:16.829253 4874 e2e_test.go:97] The --provider flag is not set. Treating as a conformance test. Some tests may not be run.
>>> testContext.KubeConfig: /home/eparis/kubectl.kubeconfig
18:48:37 rpm -qa kube\* brew\*
18:48:37 kubernetes-unit-test-0.17.1-6.el7.x86_64
18:48:37 brewkoji-1.9-1.el7eng.noarch
18:48:54
18:48:54 PLAY [ans_cluster_post] *******************************************************
18:48:54
18:48:54 TASK: [Install basic packages] ************************************************
18:48:54 ok: [10.8.53.188] => (item=brewkoji,coreutils,etcd,hostname,rsync,NetworkManager)
18:48:54
18:48:54 TASK: [Show result of pkg update] *********************************************
@eparis
eparis / gist:42ec63e538150d5b39fc
Created June 26, 2015 22:02
e2e dns test failure

/var/lib/kubernetes-unit-test/_output/local/bin/linux/amd64/e2e.test --provider="local" --ginkgo.v=true --ginkgo.focus="DNS" --kubeconfig="$HOME/.kubernetes_auth" --host="http://127.0.0.1:8080"

"
>>> testContext.KubeConfig: /root/.kubernetes_auth
INFO: Waiting up to 10m0s for all pods (need at least 0) in namespace 'default' to be running and ready
INFO: 12 / 12 pods in namespace 'default' are running and ready (5 seconds elapsed)
Running Suite: Kubernetes e2e suite
===================================