You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by nc...@apache.org on 2016/12/07 15:00:08 UTC
[10/50] [abbrv] ambari git commit: AMBARI-19067. Special characters
break creating user homes (Laszlo Puskas via magyari_sandor)
AMBARI-19067. Special characters break creating user homes (Laszlo Puskas via magyari_sandor)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/cac20e09
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/cac20e09
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/cac20e09
Branch: refs/heads/branch-dev-patch-upgrade
Commit: cac20e090151785edf2b8176d9ac0bddb1adc86f
Parents: 7f6ca9d
Author: Laszlo Puskas <lp...@hortonworks.com>
Authored: Mon Dec 5 14:07:33 2016 +0100
Committer: Sandor Magyari <sm...@hortonworks.com>
Committed: Mon Dec 5 14:07:33 2016 +0100
----------------------------------------------------------------------
.../src/main/resources/scripts/post-user-creation-hook.sh | 7 +++++++
1 file changed, 7 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/cac20e09/ambari-server/src/main/resources/scripts/post-user-creation-hook.sh
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/scripts/post-user-creation-hook.sh b/ambari-server/src/main/resources/scripts/post-user-creation-hook.sh
index 34169c1..ee8d2d1 100755
--- a/ambari-server/src/main/resources/scripts/post-user-creation-hook.sh
+++ b/ambari-server/src/main/resources/scripts/post-user-creation-hook.sh
@@ -84,6 +84,10 @@ echo "[" | cat > "$JSON_INPUT"
while read -r LINE
do
USR_NAME=$(echo "$LINE" | awk -F, '{print $1}')
+ echo "Processing user name: $USR_NAME"
+
+ # encoding the username
+ USR_NAME=$(printf "%q" "$USR_NAME")
cat <<EOF >> "$JSON_INPUT"
{
@@ -97,7 +101,10 @@ do
EOF
done <"$CSV_FILE"
+# deleting the last line
sed -i '$ d' "$JSON_INPUT"
+
+# appending json closing elements to the end of the file
echo $'}\n]' | cat >> "$JSON_INPUT"
echo "Generating file $JSON_INPUT ... DONE."
echo "Processing post user creation hook payload ... DONE."