Isilon / isilon_hadoop_tools

Tools for Using Hadoop with OneFS
https://pypi.org/project/isilon-hadoop-tools/
MIT License
14 stars 21 forks source link

group stub file has error #63

Closed nickyruggs closed 5 years ago

nickyruggs commented 5 years ago

the hadoopqa and hadoop groups are stuck on the same line for a hwx run, this issues is not there for cdh.

tucked commented 5 years ago

Easy repro:

# bash /ifs/isilon_create_users.sh --dist hwx
...
# tail System.group
HTTP:x:1032:
knox:x:1033:
ambari-server:x:1034:
druid:x:1035:
keyadmin:x:1036:
rangerlookup:x:1037:
yarn-ats:x:1038:
gpadmin:x:1039:
anonymous:x:1040:
hadoopqa:x:1017: hadoop:x:1041:hdfs,mapred,yarn,yarn-ats-hbase,hbase,storm,falcon,tracer,tez,hive,hcat,oozie,zookeeper,ambari-qa,flume,hue,accumulo,hadoopqa,sqoop,spark,mahout,ranger,kms,atlas,ams,kafka,zeppelin,livy,logsearch,infra-solr,activity_analyzer,activity_explorer,HTTP,knox,ambari-server,druid,keyadmin,rangerlookup,yarn-ats,gpadmin,
tucked commented 5 years ago

First, both groups are added: https://github.com/Isilon/isilon_hadoop_tools/blob/e13facd076897cf74226262b66551e33b3fe9e1b/isilon_create_users.sh#L230

...
hadoopqa:x:1017:
...
hadoop:x:1042:
...

Then, hadoop is searched for (to have users added): https://github.com/Isilon/isilon_hadoop_tools/blob/e13facd076897cf74226262b66551e33b3fe9e1b/isilon_create_users.sh#L260 This actually finds 2 matches (hadoop and hadoopqa), though, separated by a newline:

+ sprgrp='hadoopqa:x:1017:
hadoop:x:1042:'

(Luckily, hadoop comes 2nd, so appending to this string adds the users to the intended group.) When all users have been added, the existing entries are deleted and sprgrp is appended: https://github.com/Isilon/isilon_hadoop_tools/blob/e13facd076897cf74226262b66551e33b3fe9e1b/isilon_create_users.sh#L268-L269 The problem is that, since the de-reference of sprgrp is not quoted, the newline is treated as excess whitespace and collapsed:

+ sed -i .bak /hadoop/d foo.group
+ echo hadoopqa:x:1017: hadoop:x:1042:hdfs,mapred,yarn,yarn-ats-hbase,hbase,storm,falcon,tracer,tez,hive,hcat,oozie,zookeeper,ambari-qa,flume,hue,accumulo,hadoopqa,sqoop,spark,mahout,ranger,kms,atlas,ams,kafka,zeppelin,livy,logsearch,infra-solr,activity_analyzer,activity_explorer,HTTP,knox,ambari-server,druid,keyadmin,rangerlookup,yarn-ats,gpadmin,

Here is a simpler demonstration of this behavior:

# msg="Hello
> world"
# echo $msg
Hello world
# echo "$msg"
Hello
world