summaryrefslogtreecommitdiffstats
path: root/extras
diff options
context:
space:
mode:
authorRajesh Amaravathi <rajesh@redhat.com>2011-12-26 14:39:24 +0530
committerVijay Bellur <vijay@gluster.com>2012-01-05 09:18:11 -0800
commit5303f98f674ab5cb600dde0394ff7ddd5ba3c98a (patch)
tree52f6427817e704676b72694973103cee028bb449 /extras
parent22282b4fb82b83621c15773c4c44ff3d28a82e3c (diff)
extras: add check for brick path existence
Adding a couple of checks to validate brick path(s) Change-Id: I2d8538add21407d9457542373b528c2a02cd7eb6 BUG: 765572 Signed-off-by: Rajesh Amaravathi <rajesh@redhat.com> Reviewed-on: http://review.gluster.com/2514 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'extras')
-rwxr-xr-xextras/clear_xattrs.sh16
1 files changed, 13 insertions, 3 deletions
diff --git a/extras/clear_xattrs.sh b/extras/clear_xattrs.sh
index bdce5b895a3..dd04731e8bd 100755
--- a/extras/clear_xattrs.sh
+++ b/extras/clear_xattrs.sh
@@ -16,24 +16,34 @@ remove_xattrs ()
main ()
{
if [ -z "$1" ]; then
- echo "Please specify the brick path(s)";
+ echo "Usage: $0 <brick_path(s)>";
exit 1;
fi
+ export PATH;
which getfattr > /dev/null 2>&1;
if [ $? -ne 0 ]; then
echo "attr package missing";
- exit 1;
+ exit 2;
fi
which setfattr > /dev/null 2>&1;
if [ $? -ne 0 ]; then
echo "attr package missing";
- exit 1;
+ exit 2;
fi
for brick in "$@";
do
+ stat "$brick" > /dev/null 2>&1;
+ if [ $? -ne 0 ]; then
+ echo "brick: $brick does not exist";
+ exit 3;
+ fi
+ if [ ! -d "$brick" ]; then
+ echo "$brick: not a directory";
+ exit 4;
+ fi
echo "xattr clean-up in progress: $brick";
remove_xattrs "$brick";
echo "$brick ready to be used as a glusterfs brick";