Mridubhatnagar has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/382200 )

Change subject: Improve error message of become
......................................................................

Improve error message of become

To change to the tool user command
become <TOOL_NAME> is run. As of now,
when toolname does not start with
prefix "tools. " or home directory for
the tool is not present. Error message
"become: no such tool" is returned.
This patch makes the error message
precise and specific. When the name of
the tool does not start with "tools. "
message "A valid toolname must start
with "tools. " is returned. And if
home directory is not created. Then
error message would be "No home
directory for <TOOL_NAME> is
created"

Bug: T149511
Change-Id: I70caae782e6015ae5477ad1d539715138b942df1
---
M misctools/become
1 file changed, 6 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/labs/toollabs 
refs/changes/00/382200/1

diff --git a/misctools/become b/misctools/become
index c4cd3f6..05e4f7e 100755
--- a/misctools/become
+++ b/misctools/become
@@ -24,8 +24,12 @@
 shift
 
 # Test whether the given tool exists.
-if ! id "$prefix.$tool" >/dev/null 2>&1 || ! [ -d "/data/project/$tool" ]; then
-  echo "$(basename $0): no such tool '$tool'" >&2
+if ! id "$prefix.$tool" >/dev/null 2>&1 then
+  echo "$(basename $0): A valid toolname starts with prefix tools.">&2
+  exit 1
+fi
+if ! [ -d "/data/project/$tool" ]; then
+  echo "$(basename $0): Home directory for tool '$tool' has not yet been 
created" >&2
   exit 1
 fi
 

-- 
To view, visit https://gerrit.wikimedia.org/r/382200
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I70caae782e6015ae5477ad1d539715138b942df1
Gerrit-PatchSet: 1
Gerrit-Project: labs/toollabs
Gerrit-Branch: master
Gerrit-Owner: Mridubhatnagar <mridubhatna...@rediffmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to