Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Post user creation hook not working

Post user creation hook not working

New Contributor

I have enabled post user creation hook following this documentation.
https://docs.cloudera.com/HDPDocuments/Ambari-2.7.4.0/administering-ambari/content/amb_enable_user_h...

 

Cluster Info:

Ambari version: 2.7.4.0
Secured by MIT kerberos

 

My expectation is when I create user through ambari ui, a local os user is created and a home directory in hdfs under /user/<new_user> is created. So I went ahead and created a user "monitoring". I have gone through the ambari-server logs. It is exiting with an exit code 0. 

 

 

2020-05-08 06:45:27,894  INFO [ambari-client-thread-50] UserHookService:107 - Executing user hook for BatchUserHookContext{userGroups={monitoring=[]}}.
2020-05-08 06:45:27,894  INFO [ambari-client-thread-50] UserHookService:123 - Triggering user hook for user: BatchUserHookContext{userGroups={monitoring=[]}}
2020-05-08 06:45:27,895  INFO [pool-4-thread-1] UserHookService:131 - Preparing hook execution for event: UserCreatedEvent{eventType=USER_CREATED}
2020-05-08 06:45:27,919 ERROR [ambari-action-scheduler] ActionScheduler:817 - Execution command has no timeout parameter{"clusterName":"dev","requestId":230,"stageId":-1,"taskId":1253,"commandId":"230--1","hostname":"_internal_ambari","role":"AMBARI_SERVER_ACTION","hostLevelParams":{},"roleParams":{"ACTION_USER_NAME":"ambari","ACTION_NAME":"org.apache.ambari.server.serveraction.users.PostUserCreationHookServerAction"},"roleCommand":"EXECUTE","clusterHostInfo":{},"configurations":{},"configurationAttributes":{},"configurationTags":{},"forceRefreshConfigTagsBeforeExecution":false,"commandParams":{"cmd-hdfs-principal":"hdfs-dev@DOMAIN.COM","cmd-input-file":"/var/lib/ambari-server/data/tmp/user_hook_input_1588920327898.csv","cluster-security-type":"KERBEROS","cmd-hdfs-user":"hdfs","cmd-payload":"{\"monitoring\":[]}","cmd-hdfs-keytab":"/etc/security/keytabs/hdfs.headless.keytab","hook-script":"/var/lib/ambari-server/resources/scripts/post-user-creation-hook.sh","cluster-name":"dev","cluster-id":"2"},"serviceName":"","kerberosCommandParams":[],"localComponents":[],"availableServices":{},"componentVersionMap":{"HDFS":{"SECONDARY_NAMENODE":"3.1.4.0-315","HDFS_CLIENT":"3.1.4.0-315","ZKFC":"3.1.4.0-315","NFS_GATEWAY":"3.1.4.0-315","DATANODE":"3.1.4.0-315","JOURNALNODE":"3.1.4.0-315","NAMENODE":"3.1.4.0-315"},"MAPREDUCE2":{"MAPREDUCE2_CLIENT":"3.1.4.0-315","HISTORYSERVER":"3.1.4.0-315"},"TEZ":{"TEZ_CLIENT":"3.1.4.0-315"},"HBASE":{"HBASE_REGIONSERVER":"3.1.4.0-315","HBASE_CLIENT":"3.1.4.0-315","HBASE_MASTER":"3.1.4.0-315","PHOENIX_QUERY_SERVER":"3.1.4.0-315"},"ZOOKEEPER":{"ZOOKEEPER_SERVER":"3.1.4.0-315","ZOOKEEPER_CLIENT":"3.1.4.0-315"},"RANGER_KMS":{"RANGER_KMS_SERVER":"3.1.4.0-315"},"YARN":{"NODEMANAGER":"3.1.4.0-315","TIMELINE_READER":"3.1.4.0-315","YARN_CLIENT":"3.1.4.0-315","APP_TIMELINE_SERVER":"3.1.4.0-315","YARN_REGISTRY_DNS":"3.1.4.0-315","RESOURCEMANAGER":"3.1.4.0-315"},"KNOX":{"KNOX_GATEWAY":"3.1.4.0-315"},"ATLAS":{"ATLAS_CLIENT":"3.1.4.0-315","ATLAS_SERVER":"3.1.4.0-315"},"RANGER":{"RANGER_ADMIN":"3.1.4.0-315","RANGER_TAGSYNC":"3.1.4.0-315","RANGER_USERSYNC":"3.1.4.0-315"},"HIVE":{"HIVE_SERVER":"3.1.4.0-315","HIVE_SERVER_INTERACTIVE":"3.1.4.0-315","HIVE_METASTORE":"3.1.4.0-315","HIVE_CLIENT":"3.1.4.0-315"},"ZEPPELIN":{"ZEPPELIN_MASTER":"3.1.4.0-315"},"KAFKA":{"KAFKA_BROKER":"3.1.4.0-315"},"SPARK2":{"SPARK2_CLIENT":"3.1.4.0-315","SPARK2_THRIFTSERVER":"3.1.4.0-315","LIVY2_SERVER":"3.1.4.0-315","SPARK2_JOBHISTORYSERVER":"3.1.4.0-315"}},"commandType":"EXECUTION_COMMAND"}
2020-05-08 06:45:27,940  INFO [Server Action Executor Worker 1253] PostUserCreationHookServerAction:131 - Validating command parameters ...
2020-05-08 06:45:27,940  INFO [Server Action Executor Worker 1253] PostUserCreationHookServerAction:158 - Command parameter validation passed.
2020-05-08 06:45:27,942  INFO [Server Action Executor Worker 1253] CsvFilePersisterService:106 - Persisting map data to csv file
2020-05-08 06:45:27,942  INFO [Server Action Executor Worker 1253] CsvFilePersisterService:82 - Persisting collection to csv file
2020-05-08 06:45:27,942  INFO [Server Action Executor Worker 1253] CsvFilePersisterService:86 - Collection successfully persisted to csv file.
2020-05-08 06:45:27,942  INFO [Server Action Executor Worker 1253] ShellCommandUtilityWrapper:48 - Running command: /var/lib/ambari-server/resources/scripts/post-user-creation-hook.sh
2020-05-08 06:45:27,970  INFO [Server Action Executor Worker 1253] PostUserCreationHookServerAction:101 - Execution of command [ [/var/lib/ambari-server/resources/scripts/post-user-creation-hook.sh, /var/lib/ambari-server/data/tmp/user_hook_input_1588920327898.csv, KERBEROS, hdfs-dev@DOMAIN.COM, /etc/security/keytabs/hdfs.headless.keytab, hdfs] ] - succeeded
2020-05-08 06:45:27,970  INFO [Server Action Executor Worker 1253] PostUserCreationHookServerAction:105 - BEGIN - stdout for command [/var/lib/ambari-server/resources/scripts/post-user-creation-hook.sh, /var/lib/ambari-server/data/tmp/user_hook_input_1588920327898.csv, KERBEROS, hdfs-dev@DOMAIN.COM, /etc/security/keytabs/hdfs.headless.keytab, hdfs]
2020-05-08 06:45:27,970  INFO [Server Action Executor Worker 1253] PostUserCreationHookServerAction:107 - command output *** : 0
debug: OFF
Executing user hook with parameters: /var/lib/ambari-server/data/tmp/user_hook_input_1588920327898.csv KERBEROS hdfs-dev@DOMAIN.COM /etc/security/keytabs/hdfs.headless.keytab hdfs
The cluster is secure, calling kinit ...
Executing command: [ /var/lib/ambari-server/ambari-sudo.sh su 'hdfs' -l -s /bin/bash -c '/usr/bin/kinit -kt /etc/security/keytabs/hdfs.headless.keytab hdfs-dev@DOMAIN.COM' ]
Checking for required tools ...
Executing command: [ /var/lib/ambari-server/ambari-sudo.sh su 'hdfs' -l -s /bin/bash -c 'type hadoop > /dev/null 2>&1 || { echo >&2 "hadoop client not installed"; exit 1; }' ]
Executing command: [ /var/lib/ambari-server/ambari-sudo.sh su 'hdfs' -l -s /bin/bash -c 'hadoop fs -ls / > /dev/null 2>&1 || { echo >&2 "hadoop dfs not available"; exit 1; }' ]
Checking for required tools ... DONE.
Processing post user creation hook payload ...
Generating json file /var/lib/ambari-server/data/tmp/user_hook_input_1588920327898.csv.json ...
Processing user name: monitoring
Generating file /var/lib/ambari-server/data/tmp/user_hook_input_1588920327898.csv.json ... DONE.
Processing post user creation hook payload ... DONE.
Executing command: [ /var/lib/ambari-server/ambari-sudo.sh su 'hdfs' -l -s /bin/bash -c 'yarn jar /var/lib/ambari-server/resources/stack-hooks/before-START/files/fast-hdfs-resource.jar /var/lib/ambari-server/data/tmp/user_hook_input_1588920327898.csv.json' ]
debug: OFF

2020-05-08 06:45:27,970  INFO [Server Action Executor Worker 1253] PostUserCreationHookServerAction:109 - END - stdout for command [/var/lib/ambari-server/resources/scripts/post-user-creation-hook.sh, /var/lib/ambari-server/data/tmp/user_hook_input_1588920327898.csv, KERBEROS, hdfs-dev@DOMAIN.COM, /etc/security/keytabs/hdfs.headless.keytab, hdfs]

 

 

But when I run the following command I am unable to see the user created

 

 

hdfs@node1.domain.com:~$ hdfs dfs -ls /user
Found 8 items
drwxrwx---   - ambari-qa hdfs            0 2020-04-29 18:10 /user/ambari-qa
drwxr-xr-x   - hbase     hdfs            0 2020-01-13 08:14 /user/hbase
drwx------   - hdfs      hdfs            0 2020-04-23 09:58 /user/hdfs
drwxr-xr-x   - hive      hdfs            0 2020-01-13 08:14 /user/hive
drwxrwxr-x   - livy      hdfs            0 2020-03-12 09:44 /user/livy
drwxrwxr-x   - spark     hdfs            0 2020-01-13 16:53 /user/spark
drwxrwx---   - yarn-ats  hadoop          0 2020-04-30 10:47 /user/yarn-ats
drwxr-xr-x   - zeppelin  hdfs            0 2020-01-22 14:13 /user/zeppelin

 

 

Anything that I am missing here. Also there are no error files created under

/var/lib/ambari-agent/tmp on the worker nodes.

Don't have an account?
Coming from Hortonworks? Activate your account here