)
if args.prepend_to_path != '':
- path = os.environ.get('PATH', '')
+ path = os.environ.get('PATH', os.defpath)
os.environ['PATH'] = args.prepend_to_path + ":" + path
setup_statedir(args.statedir)
print >> sys.stderr, DEVMODEMSG
os.execvp('python', ['python'] + sys.argv)
sys.path.insert(0, os.path.join(MYDIR, 'pybind'))
- if MYDIR not in os.environ['PATH']:
+ if os.environ.has_key('PATH') and MYDIR not in os.environ['PATH']:
os.environ['PATH'] += ':' + MYDIR
import argparse
CEPH_DISK_ARGS+=" --verbose"
TIMEOUT=360
+cat=$(which cat)
+timeout=$(which timeout)
+diff=$(which diff)
+
function setup() {
teardown
mkdir $DIR
tweak_path use_path || return 1
}
+function test_no_path() {
+ ( unset PATH ; test_activate_dir ) || return 1
+}
+
# ceph-disk prepare returns immediately on success if the magic file
# exists on the --osd-data directory.
function test_activate_dir_magic() {
prepare $osd_data || return 1
CEPH_ARGS="$CEPH_ARGS --osd-journal-size=100 --osd-data=$osd_data" \
- timeout $TIMEOUT ./ceph-disk $CEPH_DISK_ARGS \
+ $timeout $TIMEOUT ./ceph-disk $CEPH_DISK_ARGS \
activate \
--mark-init=none \
$osd_data || return 1
- timeout $TIMEOUT ./ceph osd pool set data size 1 || return 1
- local id=$(cat $osd_data/whoami)
+ $timeout $TIMEOUT ./ceph osd pool set data size 1 || return 1
+ local id=$($cat $osd_data/whoami)
local weight=1
./ceph osd crush add osd.$id $weight root=default host=localhost || return 1
echo FOO > $DIR/BAR
- timeout $TIMEOUT ./rados --pool data put BAR $DIR/BAR || return 1
- timeout $TIMEOUT ./rados --pool data get BAR $DIR/BAR.copy || return 1
- diff $DIR/BAR $DIR/BAR.copy || return 1
+ $timeout $TIMEOUT ./rados --pool data put BAR $DIR/BAR || return 1
+ $timeout $TIMEOUT ./rados --pool data get BAR $DIR/BAR.copy || return 1
+ $diff $DIR/BAR $DIR/BAR.copy || return 1
}
function test_find_cluster_by_uuid() {
function run() {
local default_actions
default_actions+="test_path "
+ default_actions+="test_no_path "
default_actions+="test_find_cluster_by_uuid "
default_actions+="test_prepend_to_path "
default_actions+="test_activate_dir_magic "