From 0c39d5eb322f0e830696a7df931a6508f943ec17 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ren=C3=A9=20Nussbaumer?= <rn@google.com>
Date: Mon, 21 Mar 2011 16:47:47 +0100
Subject: [PATCH] Remove old ensure-dirs (no longer needed)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: RenΓ© Nussbaumer <rn@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
---
 .gitignore             |   1 -
 Makefile.am            |   3 -
 daemons/ensure-dirs.in | 168 -----------------------------------------
 3 files changed, 172 deletions(-)
 delete mode 100644 daemons/ensure-dirs.in

diff --git a/.gitignore b/.gitignore
index ab52962fb..44f016149 100644
--- a/.gitignore
+++ b/.gitignore
@@ -38,7 +38,6 @@
 
 # daemons
 /daemons/daemon-util
-/daemons/ensure-dirs
 /daemons/ganeti-cleaner
 /daemons/ganeti-confd
 /daemons/ganeti-masterd
diff --git a/Makefile.am b/Makefile.am
index c9f3aec82..dd9035a8f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -125,7 +125,6 @@ CLEANFILES = \
 	epydoc.conf \
 	autotools/replace_vars.sed \
 	daemons/daemon-util \
-	daemons/ensure-dirs \
 	daemons/ganeti-cleaner \
 	devel/upload \
 	doc/examples/bash_completion \
@@ -484,7 +483,6 @@ nodist_pkglib_python_scripts = \
 
 pkglib_SCRIPTS = \
 	daemons/daemon-util \
-	daemons/ensure-dirs \
 	tools/kvm-ifup \
 	$(pkglib_python_scripts)
 
@@ -507,7 +505,6 @@ EXTRA_DIST = \
 	autotools/testrunner \
 	$(RUN_IN_TEMPDIR) \
 	daemons/daemon-util.in \
-	daemons/ensure-dirs.in \
 	daemons/ganeti-cleaner.in \
 	$(pkglib_python_scripts) \
 	devel/upload.in \
diff --git a/daemons/ensure-dirs.in b/daemons/ensure-dirs.in
deleted file mode 100644
index ff6d744e0..000000000
--- a/daemons/ensure-dirs.in
+++ /dev/null
@@ -1,168 +0,0 @@
-#!/bin/bash
-
-set -e
-
-LIBDIR="@LOCALSTATEDIR@/lib"
-DATADIR="${LIBDIR}/ganeti"
-RUNDIR="@LOCALSTATEDIR@/run"
-GNTRUNDIR="${RUNDIR}/ganeti"
-LOGDIR="@LOCALSTATEDIR@/log"
-GNTLOGDIR="${LOGDIR}/ganeti"
-LOCKDIR="@LOCALSTATEDIR@/lock"
-
-_fileset_owner() {
-  case "$1" in
-    masterd)
-      echo "@GNTMASTERUSER@:@GNTMASTERDGROUP@"
-      ;;
-    confd)
-      echo "@GNTCONFDUSER@:@GNTCONFDGROUP@"
-      ;;
-    rapi)
-      echo "@GNTRAPIUSER@:@GNTRAPIGROUP@"
-      ;;
-    noded)
-      echo "root:@GNTMASTERDGROUP@"
-      ;;
-    daemons)
-      echo "@GNTMASTERUSER@:@GNTDAEMONSGROUP@"
-      ;;
-    masterd-confd)
-      echo "@GNTMASTERUSER@:@GNTCONFDGROUP@"
-      ;;
-    *)
-      echo "root:root"
-      ;;
-  esac
-}
-
-_ensure_file() {
-  local file="$1"
-  local perm="$2"
-  local owner="$3"
-
-  [[ -e "${file}" ]] || return 1
-  chmod ${perm} "${file}"
-
-  if ! [[ -z "${owner}" ]]; then
-    chown ${owner} "${file}"
-  fi
-
-  return 0
-}
-
-_ensure_dir() {
-  local dir="$1"
-  local perm="$2"
-  local owner="$3"
-
-  [[ -d "${dir}" ]] || mkdir "${dir}"
-
-  _ensure_file "${dir}" "${perm}" "${owner}"
-}
-
-_gather_files() {
-  local path="$1"
-  local perm="$2"
-  local user="$3"
-  local group="$4"
-
-  shift 4
-
-  find "${path}" -type f "(" "!" -perm ${perm} -or "(" "!" -user ${user} -or \
-       "!" -group ${group} ")" ")" "$@"
-}
-
-_ensure_datadir() {
-  local full_run="$1"
-
-  _ensure_dir ${DATADIR} 0755 "$(_fileset_owner masterd)"
-  _ensure_dir ${DATADIR}/queue 0700 "$(_fileset_owner masterd)"
-  _ensure_dir ${DATADIR}/queue/archive 0700 "$(_fileset_owner masterd)"
-  _ensure_dir ${DATADIR}/uidpool 0750 "$(_fileset_owner noded)"
-  _ensure_dir ${DATADIR}/rapi 0750 "$(_fileset_owner rapi)"
-
-  # We ignore these files if they don't exists (incomplete setup)
-  _ensure_file ${DATADIR}/cluster-domain-secret 0640 \
-               "$(_fileset_owner masterd)" || :
-  _ensure_file ${DATADIR}/config.data 0640 "$(_fileset_owner masterd-confd)" || :
-  _ensure_file ${DATADIR}/hmac.key 0440 "$(_fileset_owner confd)" || :
-  _ensure_file ${DATADIR}/known_hosts 0644 "$(_fileset_owner masterd)" || :
-  _ensure_file ${DATADIR}/rapi.pem 0440 "$(_fileset_owner rapi)" || :
-  _ensure_file ${DATADIR}/rapi/users 0640 "$(_fileset_owner rapi)" || :
-  _ensure_file ${DATADIR}/server.pem 0440 "$(_fileset_owner masterd)" || :
-  _ensure_file ${DATADIR}/queue/serial 0600 "$(_fileset_owner masterd)" || :
-
-  # To not change the utils.LockFile object
-  touch ${DATADIR}/queue/lock
-  _ensure_file ${DATADIR}/queue/lock 0600 "$(_fileset_owner masterd)"
-
-  if ! [[ -z "${full_run}" ]]; then
-    local queue_owner="$(_fileset_owner masterd)"
-    local ssconf_owner="$(_fileset_owner noded)"
-
-    _gather_files ${DATADIR}/queue 0600 @GNTMASTERUSER@ @GNTMASTERDGROUP@ | \
-    while read path; do
-      _ensure_file "$path" 0600 "$queue_owner"
-    done
-
-    _gather_files ${DATADIR} 0600 root @GNTMASTERDGROUP@ -name 'ssconf_*' | \
-    while read path; do
-      _ensure_file "$path" 0444 "$ssconf_owner"
-    done
-  fi
-}
-
-_ensure_rundir() {
-  _ensure_dir ${GNTRUNDIR} 0775 "$(_fileset_owner daemons)"
-  _ensure_dir ${GNTRUNDIR}/socket 0750 "$(_fileset_owner daemons)"
-  _ensure_dir ${GNTRUNDIR}/bdev-cache 0755 "$(_fileset_owner noded)"
-  _ensure_dir ${GNTRUNDIR}/instance-disks 0755 "$(_fileset_owner noded)"
-  _ensure_dir ${GNTRUNDIR}/crypto 0700 "$(_fileset_owner noded)"
-  _ensure_dir ${GNTRUNDIR}/import-export 0755 "$(_fileset_owner noded)"
-
-  # We ignore this file if it don't exists (not yet start up)
-  _ensure_file ${GNTRUNDIR}/socket/ganeti-master 0770 \
-               "$(_fileset_owner daemons)" || :
-}
-
-_ensure_logdir() {
-  _ensure_dir ${GNTLOGDIR} 0770 "$(_fileset_owner daemons)"
-  _ensure_dir ${GNTLOGDIR}/os 0750 "$(_fileset_owner daemons)"
-
-  # We ignore these files if they don't exists (incomplete setup)
-  _ensure_file ${GNTLOGDIR}/master-daemon.log 0600 "$(_fileset_owner masterd)" || :
-  _ensure_file ${GNTLOGDIR}/conf-daemon.log 0600 "$(_fileset_owner confd)" || :
-  _ensure_file ${GNTLOGDIR}/node-daemon.log 0600 "$(_fileset_owner noded)" || :
-  _ensure_file ${GNTLOGDIR}/rapi-daemon.log 0600 "$(_fileset_owner rapi)" || :
-}
-
-_ensure_lockdir() {
-  _ensure_dir ${LOCKDIR} 1777 ""
-}
-
-_operate_while_hold() {
-  local fn=$1
-  local path=$2
-  shift 2
-
-  (cd ${path};
-   ${fn} "$@")
-}
-
-main() {
-  local full_run
-
-  while getopts "f" OPTION; do
-    case ${OPTION} in
-      f) full_run=1 ;;
-    esac
-  done
-
-  _operate_while_hold "_ensure_datadir" ${DATADIR} ${full_run}
-  _operate_while_hold "_ensure_rundir" ${RUNDIR}
-  _operate_while_hold "_ensure_logdir" ${LOGDIR}
-  _operate_while_hold "_ensure_lockdir" @LOCALSTATEDIR@
-}
-
-main "$@"
-- 
GitLab