mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	Remove dangling shell functions
This commit is contained in:
		@@ -249,20 +249,6 @@ kube::golang::host_platform() {
 | 
			
		||||
  echo "$(go env GOHOSTOS)/$(go env GOHOSTARCH)"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
kube::golang::current_platform() {
 | 
			
		||||
  local os="${GOOS-}"
 | 
			
		||||
  if [[ -z $os ]]; then
 | 
			
		||||
    os=$(go env GOHOSTOS)
 | 
			
		||||
  fi
 | 
			
		||||
 | 
			
		||||
  local arch="${GOARCH-}"
 | 
			
		||||
  if [[ -z $arch ]]; then
 | 
			
		||||
    arch=$(go env GOHOSTARCH)
 | 
			
		||||
  fi
 | 
			
		||||
 | 
			
		||||
  echo "$os/$arch"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Takes the platform name ($1) and sets the appropriate golang env variables
 | 
			
		||||
# for that platform.
 | 
			
		||||
kube::golang::set_platform_envs() {
 | 
			
		||||
 
 | 
			
		||||
@@ -42,32 +42,6 @@ kube::util::wait_for_url() {
 | 
			
		||||
  return 1
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# returns a random port
 | 
			
		||||
kube::util::get_random_port() {
 | 
			
		||||
  awk -v min=1024 -v max=65535 'BEGIN{srand(); print int(min+rand()*(max-min+1))}'
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# use netcat to check if the host($1):port($2) is free (return 0 means free, 1 means used)
 | 
			
		||||
kube::util::test_host_port_free() {
 | 
			
		||||
  local host=$1
 | 
			
		||||
  local port=$2
 | 
			
		||||
  local success=0
 | 
			
		||||
  local fail=1
 | 
			
		||||
 | 
			
		||||
  which nc >/dev/null || {
 | 
			
		||||
    kube::log::usage "netcat isn't installed, can't verify if ${host}:${port} is free, skipping the check..."
 | 
			
		||||
    return ${success}
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if [ ! $(nc -vz "${host}" "${port}") ]; then
 | 
			
		||||
    kube::log::status "${host}:${port} is free, proceeding..."
 | 
			
		||||
    return ${success}
 | 
			
		||||
  else
 | 
			
		||||
    kube::log::status "${host}:${port} is already used"
 | 
			
		||||
    return ${fail}
 | 
			
		||||
  fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Example:  kube::util::trap_add 'echo "in trap DEBUG"' DEBUG
 | 
			
		||||
# See: http://stackoverflow.com/questions/3338030/multiple-bash-traps-for-the-same-signal
 | 
			
		||||
kube::util::trap_add() {
 | 
			
		||||
@@ -264,50 +238,6 @@ kube::util::remove-gen-docs() {
 | 
			
		||||
  fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Takes a path $1 to traverse for md files to append the ga-beacon tracking
 | 
			
		||||
# link to, if needed. If $2 is set, just print files that are missing
 | 
			
		||||
# the link.
 | 
			
		||||
kube::util::gen-analytics() {
 | 
			
		||||
  local path="$1"
 | 
			
		||||
  local dryrun="${2:-}"
 | 
			
		||||
  local mdfiles dir link
 | 
			
		||||
  # find has some strange inconsistencies between darwin/linux. The
 | 
			
		||||
  # path to search must end in '/' for linux, but darwin will put an extra
 | 
			
		||||
  # slash in results if there is a trailing '/'.
 | 
			
		||||
  if [[ $( uname ) == 'Linux' ]]; then
 | 
			
		||||
    dir="${path}/"
 | 
			
		||||
  else
 | 
			
		||||
    dir="${path}"
 | 
			
		||||
  fi
 | 
			
		||||
  # We don't touch files in special dirs, and the kubectl docs are
 | 
			
		||||
  # autogenerated by gendocs.
 | 
			
		||||
  # Don't descend into .directories
 | 
			
		||||
  mdfiles=($( find "${dir}" -name "*.md" -type f \
 | 
			
		||||
              -not -path '*/\.*' \
 | 
			
		||||
              -not -path "${path}/vendor/*" \
 | 
			
		||||
              -not -path "${path}/staging/*" \
 | 
			
		||||
              -not -path "${path}/third_party/*" \
 | 
			
		||||
              -not -path "${path}/_gopath/*" \
 | 
			
		||||
              -not -path "${path}/_output/*" \
 | 
			
		||||
              -not -path "${path}/docs/user-guide/kubectl/kubectl*" ))
 | 
			
		||||
  for f in "${mdfiles[@]}"; do
 | 
			
		||||
    link=$(kube::util::analytics-link "${f#${path}/}")
 | 
			
		||||
    if grep -q -F -x "${link}" "${f}"; then
 | 
			
		||||
      continue
 | 
			
		||||
    elif [[ -z "${dryrun}" ]]; then
 | 
			
		||||
      echo -e "\n\n${link}" >> "${f}"
 | 
			
		||||
    else
 | 
			
		||||
      echo "$f"
 | 
			
		||||
    fi
 | 
			
		||||
  done
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Prints analytics link to append to a file at path $1.
 | 
			
		||||
kube::util::analytics-link() {
 | 
			
		||||
  local path="$1"
 | 
			
		||||
  echo "[]()"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Takes a group/version and returns the path to its location on disk, sans
 | 
			
		||||
# "pkg". E.g.:
 | 
			
		||||
# * default behavior: extensions/v1beta1 -> apis/extensions/v1beta1
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user