mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	Fix issues with Python3 and bring up a dev cluster
This commit is contained in:
		@@ -117,7 +117,7 @@ function get_igw_id {
 | 
			
		||||
function get_elbs_in_vpc {
 | 
			
		||||
  # ELB doesn't seem to be on the same platform as the rest of AWS; doesn't support filtering
 | 
			
		||||
  aws elb --output json describe-load-balancers  | \
 | 
			
		||||
    python -c "import json,sys; lst = [str(lb['LoadBalancerName']) for lb in json.load(sys.stdin)['LoadBalancerDescriptions'] if lb['VPCId'] == '$1']; print '\n'.join(lst)"
 | 
			
		||||
    python -c "import json,sys; lst = [str(lb['LoadBalancerName']) for lb in json.load(sys.stdin)['LoadBalancerDescriptions'] if lb['VPCId'] == '$1']; print('\n'.join(lst))"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function get_instanceid_from_name {
 | 
			
		||||
 
 | 
			
		||||
@@ -297,6 +297,6 @@ function get-password {
 | 
			
		||||
  if [[ -z "${KUBE_USER}" || -z "${KUBE_PASSWORD}" ]]; then
 | 
			
		||||
    KUBE_USER=admin
 | 
			
		||||
    KUBE_PASSWORD=$(python -c 'import string,random; \
 | 
			
		||||
      print "".join(random.SystemRandom().choice(string.ascii_letters + string.digits) for _ in range(16))')
 | 
			
		||||
      print("".join(random.SystemRandom().choice(string.ascii_letters + string.digits) for _ in range(16)))')
 | 
			
		||||
  fi
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -170,7 +170,7 @@ function get-kubeconfig-basicauth() {
 | 
			
		||||
#   KUBE_PASSWORD
 | 
			
		||||
function gen-kube-basicauth() {
 | 
			
		||||
    KUBE_USER=admin
 | 
			
		||||
    KUBE_PASSWORD=$(python -c 'import string,random; print "".join(random.SystemRandom().choice(string.ascii_letters + string.digits) for _ in range(16))')
 | 
			
		||||
    KUBE_PASSWORD=$(python -c 'import string,random; print("".join(random.SystemRandom().choice(string.ascii_letters + string.digits) for _ in range(16)))')
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Get the bearer token for the current-context in kubeconfig if one exists.
 | 
			
		||||
 
 | 
			
		||||
@@ -81,8 +81,8 @@ function set-kube-env() {
 | 
			
		||||
import pipes,sys,yaml
 | 
			
		||||
 | 
			
		||||
for k,v in yaml.load(sys.stdin).iteritems():
 | 
			
		||||
  print """readonly {var}={value}""".format(var = k, value = pipes.quote(str(v)))
 | 
			
		||||
  print """export {var}""".format(var = k)
 | 
			
		||||
  print("""readonly {var}={value}""".format(var = k, value = pipes.quote(str(v))))
 | 
			
		||||
  print("""export {var}""".format(var = k))
 | 
			
		||||
  ' < """${kube_env_yaml}""")"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -61,7 +61,7 @@ download_kube_env() {
 | 
			
		||||
  eval $(python -c '''
 | 
			
		||||
import pipes,sys,yaml
 | 
			
		||||
for k,v in yaml.load(sys.stdin).iteritems():
 | 
			
		||||
  print "readonly {var}={value}".format(var = k, value = pipes.quote(str(v)))
 | 
			
		||||
  print("readonly {var}={value}".format(var = k, value = pipes.quote(str(v))))
 | 
			
		||||
''' < /tmp/kube-env-yaml > /etc/kube-env)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -175,7 +175,7 @@ if [ ! -e "${kubelet_kubeconfig_file}" ]; then
 | 
			
		||||
import pipes,sys,yaml
 | 
			
		||||
 | 
			
		||||
for k,v in yaml.load(sys.stdin).iteritems():
 | 
			
		||||
  print "readonly {var}={value}".format(var = k, value = pipes.quote(str(v)))
 | 
			
		||||
  print("readonly {var}={value}".format(var = k, value = pipes.quote(str(v))))
 | 
			
		||||
''' < "${kube_env_yaml}")
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -80,9 +80,9 @@ failed = False
 | 
			
		||||
for testcase in parse(sys.stdin).getElementsByTagName("testcase"):
 | 
			
		||||
  if len(testcase.getElementsByTagName("failure")) != 0:
 | 
			
		||||
    failed = True
 | 
			
		||||
    print "  FAIL: {test}".format(test = testcase.getAttribute("name"))
 | 
			
		||||
    print("  FAIL: {test}".format(test = testcase.getAttribute("name")))
 | 
			
		||||
if not failed:
 | 
			
		||||
  print "  SUCCESS!"
 | 
			
		||||
  print("  SUCCESS!")
 | 
			
		||||
'
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user