## What changes were proposed in this pull request?

Disable Kerberos from Ambari UI didn't clean up keytab directories,

stderr:

```
2018-09-08 05:27:19,276 - Failed to remove identity for 
amsmon/[email protected] from the 
Ambari database - Object: null is not a known Entity type.
2018-09-08 05:27:19,298 - Failed to remove identity for 
amsmon/[email protected] from the 
Ambari database - Object: null is not a known Entity type.
2018-09-08 05:27:19,325 - Failed to remove identity for 
amsmon/[email protected] from the 
Ambari database - Object: null is not a known Entity type.
2018-09-08 05:27:19,348 - Failed to remove identity for 
amsmon/[email protected] from the 
Ambari database - Object: null is not a known Entity type.
2018-09-08 05:27:19,465 - Failed to remove identity for 
dn/[email protected] from the Ambari 
database - Object: null is not a known Entity type.
2018-09-08 05:27:19,491 - Failed to remove identity for 
dn/[email protected] from the Ambari 
database - Object: null is not a known Entity type.
2018-09-08 05:27:19,515 - Failed to remove identity for 
dn/[email protected] from the Ambari 
database - Object: null is not a known Entity type.
2018-09-08 05:27:19,539 - Failed to remove identity for 
dn/[email protected] from the Ambari 
database - Object: null is not a known Entity type.
2018-09-08 05:27:19,671 - Failed to remove identity for 
hbase/[email protected] from the 
Ambari database - Object: null is not a known Entity type.
2018-09-08 05:27:19,696 - Failed to remove identity for 
hbase/[email protected] from the 
Ambari database - Object: null is not a known Entity type.
2018-09-08 05:27:19,723 - Failed to remove identity for 
hbase/[email protected] from the 
Ambari database - Object: null is not a known Entity type.
2018-09-08 05:27:19,744 - Failed to remove identity for 
hbase/[email protected] from the 
Ambari database - Object: null is not a known Entity type.
2018-09-08 05:27:19,959 - Failed to remove identity for 
nm/[email protected] from the Ambari 
database - Object: null is not a known Entity type.
2018-09-08 05:27:19,987 - Failed to remove identity for 
nm/[email protected] from the Ambari 
database - Object: null is not a known Entity type.
2018-09-08 05:27:20,049 - Failed to remove identity for 
nn/[email protected] from the Ambari 
database - Object: null is not a known Entity type.
2018-09-08 05:27:20,376 - Failed to remove identity for 
HTTP/[email protected] from the 
Ambari database - Object: null is not a known Entity type.
2018-09-08 05:27:20,399 - Failed to remove identity for 
HTTP/[email protected] from the 
Ambari database - Object: null is not a known Entity type.
2018-09-08 05:27:20,420 - Failed to remove identity for 
HTTP/[email protected] from the 
Ambari database - Object: null is not a known Entity type.
2018-09-08 05:27:20,441 - Failed to remove identity for 
HTTP/[email protected] from the 
Ambari database - Object: null is not a known Entity type.
2018-09-08 05:27:20,590 - Failed to remove identity for 
yarn-ats-hbase/[email protected] 
from the Ambari database - Object: null is not a known Entity type.
2018-09-08 05:27:20,617 - Failed to remove identity for 
yarn-ats-hbase/[email protected] 
from the Ambari database - Object: null is not a known Entity type.
2018-09-08 05:27:20,647 - Failed to remove identity for 
yarn-ats-hbase/[email protected] 
from the Ambari database - Object: null is not a known Entity type.
2018-09-08 05:27:20,677 - Failed to remove identity for 
yarn-ats-hbase/[email protected] 
from the Ambari database - Object: null is not a known Entity type.
2018-09-08 05:27:20,768 - Failed to remove identity for 
zookeeper/[email protected] from the 
Ambari database - Object: null is not a known Entity type.
2018-09-08 05:27:20,798 - Failed to remove identity for 
zookeeper/[email protected] from the 
Ambari database - Object: null is not a known Entity type
```

```
[root@ctr-e138-1518143905142-467151-01-000002 ~]# ls -lrt /etc/security/keytabs/
total 56
-rw-r----- 1 ambari-qa  hadoop 318 Sep  7 23:00 
kerberos.service_check.090718.keytab
-r-------- 1 slava      slava  353 Sep  7 23:05 ambari.server.keytab
-r--r----- 1 root       hadoop 538 Sep  7 23:05 spnego.service.keytab
-r-------- 1 cstm-ams   hadoop 548 Sep  7 23:05 ams-monitor.keytab
-r-------- 1 cstm-hdfs  hadoop 533 Sep  7 23:05 nfs.service.keytab
-r--r----- 1 cstm-hbase hadoop 338 Sep  7 23:05 hbase.headless.keytab
-r-------- 1 yarn-ats   hadoop 328 Sep  7 23:05 
yarn-ats.hbase-client.headless.keytab
-r-------- 1 cstm-hdfs  hadoop 528 Sep  7 23:05 dn.service.keytab
-r-------- 1 yarn-ats   hadoop 588 Sep  7 23:05 
yarn-ats.hbase-regionserver.service.keytab
-r--r----- 1 ambari-qa  hadoop 333 Sep  7 23:05 smokeuser.headless.keytab
-r-------- 1 cstm-hbase hadoop 543 Sep  7 23:05 hbase.service.keytab
-r-------- 1 cstm-hdfs  hadoop 528 Sep  7 23:05 nn.service.keytab
-r-------- 1 yarn-ats   hadoop 588 Sep  7 23:05 
yarn-ats.hbase-master.service.keytab
-r-------- 1 cstm-hdfs  hadoop 333 Sep  7 23:05 hdfs.headless.keytab
```

This occurred for several reasons related to many iterations of changes to the 
Kerberos enable and clean up processes.  This patch attempts to fix the 
inconsistencies the lead to the cleanup failures - whether a service, 
component, or host was removed or Kerberos was being disabled.  Now the keytab 
files, principals/accounts, and Ambari DB records are being properly cleaned 
up. 

This was cherry-picked from #2334 

## How was this patch tested?

Manually tested various scenarios when Kerberos was enabled
- remove a service
- remove a component
- move a component
- remove a host
- regenerate keytab files
- regenerate missing keytab file
- disable Kerberos
- Ambari upgrade
- stack upgrade

Unit tests were updated and all passed. 

Please review [Ambari Contributing 
Guide](https://cwiki.apache.org/confluence/display/AMBARI/How+to+Contribute) 
before opening a pull request.

[ Full content available at: https://github.com/apache/ambari/pull/2335 ]
This message was relayed via gitbox.apache.org for [email protected]

Reply via email to