Repository: ambari Updated Branches: refs/heads/branch-2.5 8f26728cc -> 3e0d02145
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/3e0d0214 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/3e0d0214 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/3e0d0214 Branch: refs/heads/branch-2.5 Commit: 3e0d02145e836621a375613767672a5ccb908203 Parents: 8f26728 Author: Laszlo Puskas <[email protected]> Authored: Mon Dec 5 14:07:33 2016 +0100 Committer: Sandor Magyari <[email protected]> Committed: Mon Dec 5 14:12:44 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/3e0d0214/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."
