{"action":"created","comment":{"url":"https://api.github.com/repos/apache/ambari/pulls/comments/180561295","pull_request_review_id":111003229,"id":180561295,"diff_hunk":"@@ -0,0 +1,62 @@\n+package org.apache.ambari.server.serveraction.kerberos;\n+\n+import static org.easymock.EasyMock.expect;\n+import static org.easymock.EasyMock.replay;\n+import static org.easymock.EasyMock.verify;\n+import static org.mockito.Matchers.anyBoolean;\n+\n+import org.apache.ambari.server.agent.stomp.TopologyHolder;\n+import org.apache.ambari.server.audit.AuditLogger;\n+import org.apache.ambari.server.events.TopologyUpdateEvent;\n+import org.apache.ambari.server.testutils.PartialNiceMockBinder;\n+import org.easymock.EasyMock;\n+import org.easymock.EasyMockSupport;\n+import org.junit.Before;\n+import org.junit.Test;\n+\n+import com.google.inject.AbstractModule;\n+import com.google.inject.Guice;\n+import com.google.inject.Injector;\n+import com.google.inject.Provider;\n+\n+public class KerberosTopologyUpdateTriggerServerActionTest extends EasyMockSupport {\n+\n+  private static TopologyHolder topologyHolder = EasyMock.createNiceMock(TopologyHolder.class);\n+\n+  private KerberosTopologyUpdateTriggerServerAction action;\n+\n+  @Before\n+  public void init() {\n+    final Injector injector = createInjector();\n+    action = injector.getInstance(KerberosTopologyUpdateTriggerServerAction.class);\n+  }\n+\n+  @Test\n+  public void shouldUpdateTopology() throws Exception {\n+    final TopologyUpdateEvent event = createNiceMock(TopologyUpdateEvent.class);\n+    expect(topologyHolder.getCurrentData()).andReturn(event).once();\n+    expect(topologyHolder.updateData(event)).andReturn(anyBoolean()).once();\n+    replay(topologyHolder);\n+    action.execute(null);\n+    verify(topologyHolder);\n+  }\n+\n+  static class TestTopologyHolderProvider implements Provider<TopologyHolder> {\n+    @Override\n+    public TopologyHolder get() {\n+      return topologyHolder;\n+    }\n+  }\n+\n+  private Injector createInjector() {","path":"ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/KerberosTopologyUpdateTriggerServerActionTest.java","position":69,"original_position":51,"commit_id":"f58129e58e9651bd39672e7f470f0780d9cca4f7","original_commit_id":"4fa7d6cf8d23e53643558533ae7da54b6aa2f416","user":{"login":"smolnar82","id":34065904,"avatar_url":"https://avatars3.githubusercontent.com/u/34065904?v=4","gravatar_id":"","url":"https://api.github.com/users/smolnar82","html_url":"https://github.com/smolnar82","followers_url":"https://api.github.com/users/smolnar82/followers","following_url":"https://api.github.com/users/smolnar82/following{/other_user}","gists_url":"https://api.github.com/users/smolnar82/gists{/gist_id}","starred_url":"https://api.github.com/users/smolnar82/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smolnar82/subscriptions","organizations_url":"https://api.github.com/users/smolnar82/orgs","repos_url":"https://api.github.com/users/smolnar82/repos","events_url":"https://api.github.com/users/smolnar82/events{/privacy}","received_events_url":"https://api.github.com/users/smolnar82/received_events","type":"User","site_admin":false},"body":"We need Guice anyway...either the field would be injected or the constructor...how else would you get `TopologyHolder`? Please note this a Singleton scoped Guice bean.","created_at":"2018-04-10T20:43:13Z","updated_at":"2018-04-10T20:43:13Z","html_url":"https://github.com/apache/ambari/pull/951#discussion_r180561295","pull_request_url":"https://api.github.com/repos/apache/ambari/pulls/951","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/apache/ambari/pulls/comments/180561295"},"html":{"href":"https://github.com/apache/ambari/pull/951#discussion_r180561295"},"pull_request":{"href":"https://api.github.com/repos/apache/ambari/pulls/951"}},"in_reply_to_id":180549696},"pull_request":{"url":"https://api.github.com/repos/apache/ambari/pulls/951","id":180593995,"html_url":"https://github.com/apache/ambari/pull/951","diff_url":"https://github.com/apache/ambari/pull/951.diff","patch_url":"https://github.com/apache/ambari/pull/951.patch","issue_url":"https://api.github.com/repos/apache/ambari/issues/951","number":951,"state":"open","locked":false,"title":"[AMBARI-23526] Make sure that we update topology cache on agent side when Kerberizing the cluster","user":{"login":"smolnar82","id":34065904,"avatar_url":"https://avatars3.githubusercontent.com/u/34065904?v=4","gravatar_id":"","url":"https://api.github.com/users/smolnar82","html_url":"https://github.com/smolnar82","followers_url":"https://api.github.com/users/smolnar82/followers","following_url":"https://api.github.com/users/smolnar82/following{/other_user}","gists_url":"https://api.github.com/users/smolnar82/gists{/gist_id}","starred_url":"https://api.github.com/users/smolnar82/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smolnar82/subscriptions","organizations_url":"https://api.github.com/users/smolnar82/orgs","repos_url":"https://api.github.com/users/smolnar82/repos","events_url":"https://api.github.com/users/smolnar82/events{/privacy}","received_events_url":"https://api.github.com/users/smolnar82/received_events","type":"User","site_admin":false},"body":"## What changes were proposed in this pull request?\r\n\r\nThere is a cache (in fact there are multiple caches) holding properties on different levels (host, component, etc...) in `ambari-agent` to support better performance. The problem was that this cache was not updated when we enabled Kerberos so that `ambari-agent` did not realize that unlimited key JCE policy should have been installed.\r\nTo fix this issue `ambari-server` should send an event to the agent upon cluster Kerberization to update `topology cache` (this is where `componentLevelParams` are being stored).\r\n\r\n## How was this patch tested?\r\n\r\nRunning Junit tests and added a new one to test the new class. Latest results in `ambari-server`:\r\n```\r\nambari-server smolnar$ mvn clean install\r\n...\r\n[INFO] ------------------------------------------------------------------------\r\n[INFO] BUILD SUCCESS\r\n[INFO] ------------------------------------------------------------------------\r\n[INFO] Total time: 27:00 min\r\n[INFO] Finished at: 2018-04-10T21:28:48+02:00\r\n[INFO] Final Memory: 209M/836M\r\n[INFO] ------------------------------------------------------------------------\r\n```\r\n\r\nBesides unit testing the following E2E test was executed:\r\n\r\n1. had a cluster with HDFS only; created a snapshot here\r\n2. Kerberized the cluster and confirmed that on c7402 - where only `ambari-agent` was running - the unlimited key JCE policy was **_not_** installed\r\n3. built a new `ambari-server.jar` with my changes\r\n4. went back to the snapshot (I created at step 1) and replaced the original `ambari-server.jar` with the new one\r\n5. changed the log level in `shared_initialization.py` to `INFO`\r\n6. restarted the server and the agents\r\n7. Kerberized the cluster: the new stage (`Triggering Topology Update Event`) appeared and unlimited key JCE policy was installed as part of the `DataNode` start step\r\n\r\n```\r\n[root@c7402 data]# /usr/jdk64/jdk1.8.0_112/bin/java -jar /var/lib/ambari-agent/tools/jcepolicyinfo.jar -tu\r\nUnlimited Key JCE Policy: true\r\n```\r\n\r\n<img width=\"1606\" alt=\"screen shot 2018-04-10 at 9 41 17 pm\" src=\"https://user-images.githubusercontent.com/34065904/38579900-b9cc0d6a-3d08-11e8-9d12-3f1619ff0173.png\">\r\n\r\n<img width=\"1606\" alt=\"screen shot 2018-04-10 at 9 43 01 pm\" src=\"https://user-images.githubusercontent.com/34065904/38579902-b9e6745c-3d08-11e8-8f2a-2075af6e6d7a.png\">\r\n","created_at":"2018-04-10T13:00:20Z","updated_at":"2018-04-10T20:43:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f934ebdd170c1d5ac209a82235aeb25db75f01b0","assignee":{"login":"smolnar82","id":34065904,"avatar_url":"https://avatars3.githubusercontent.com/u/34065904?v=4","gravatar_id":"","url":"https://api.github.com/users/smolnar82","html_url":"https://github.com/smolnar82","followers_url":"https://api.github.com/users/smolnar82/followers","following_url":"https://api.github.com/users/smolnar82/following{/other_user}","gists_url":"https://api.github.com/users/smolnar82/gists{/gist_id}","starred_url":"https://api.github.com/users/smolnar82/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smolnar82/subscriptions","organizations_url":"https://api.github.com/users/smolnar82/orgs","repos_url":"https://api.github.com/users/smolnar82/repos","events_url":"https://api.github.com/users/smolnar82/events{/privacy}","received_events_url":"https://api.github.com/users/smolnar82/received_events","type":"User","site_admin":false},"assignees":[{"login":"smolnar82","id":34065904,"avatar_url":"https://avatars3.githubusercontent.com/u/34065904?v=4","gravatar_id":"","url":"https://api.github.com/users/smolnar82","html_url":"https://github.com/smolnar82","followers_url":"https://api.github.com/users/smolnar82/followers","following_url":"https://api.github.com/users/smolnar82/following{/other_user}","gists_url":"https://api.github.com/users/smolnar82/gists{/gist_id}","starred_url":"https://api.github.com/users/smolnar82/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smolnar82/subscriptions","organizations_url":"https://api.github.com/users/smolnar82/orgs","repos_url":"https://api.github.com/users/smolnar82/repos","events_url":"https://api.github.com/users/smolnar82/events{/privacy}","received_events_url":"https://api.github.com/users/smolnar82/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/apache/ambari/pulls/951/commits","review_comments_url":"https://api.github.com/repos/apache/ambari/pulls/951/comments","review_comment_url":"https://api.github.com/repos/apache/ambari/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/ambari/issues/951/comments","statuses_url":"https://api.github.com/repos/apache/ambari/statuses/f58129e58e9651bd39672e7f470f0780d9cca4f7","head":{"label":"smolnar82:AMBARI-23526","ref":"AMBARI-23526","sha":"f58129e58e9651bd39672e7f470f0780d9cca4f7","user":{"login":"smolnar82","id":34065904,"avatar_url":"https://avatars3.githubusercontent.com/u/34065904?v=4","gravatar_id":"","url":"https://api.github.com/users/smolnar82","html_url":"https://github.com/smolnar82","followers_url":"https://api.github.com/users/smolnar82/followers","following_url":"https://api.github.com/users/smolnar82/following{/other_user}","gists_url":"https://api.github.com/users/smolnar82/gists{/gist_id}","starred_url":"https://api.github.com/users/smolnar82/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smolnar82/subscriptions","organizations_url":"https://api.github.com/users/smolnar82/orgs","repos_url":"https://api.github.com/users/smolnar82/repos","events_url":"https://api.github.com/users/smolnar82/events{/privacy}","received_events_url":"https://api.github.com/users/smolnar82/received_events","type":"User","site_admin":false},"repo":{"id":116741551,"name":"ambari","full_name":"smolnar82/ambari","owner":{"login":"smolnar82","id":34065904,"avatar_url":"https://avatars3.githubusercontent.com/u/34065904?v=4","gravatar_id":"","url":"https://api.github.com/users/smolnar82","html_url":"https://github.com/smolnar82","followers_url":"https://api.github.com/users/smolnar82/followers","following_url":"https://api.github.com/users/smolnar82/following{/other_user}","gists_url":"https://api.github.com/users/smolnar82/gists{/gist_id}","starred_url":"https://api.github.com/users/smolnar82/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smolnar82/subscriptions","organizations_url":"https://api.github.com/users/smolnar82/orgs","repos_url":"https://api.github.com/users/smolnar82/repos","events_url":"https://api.github.com/users/smolnar82/events{/privacy}","received_events_url":"https://api.github.com/users/smolnar82/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/smolnar82/ambari","description":"Mirror of Apache Ambari","fork":true,"url":"https://api.github.com/repos/smolnar82/ambari","forks_url":"https://api.github.com/repos/smolnar82/ambari/forks","keys_url":"https://api.github.com/repos/smolnar82/ambari/keys{/key_id}","collaborators_url":"https://api.github.com/repos/smolnar82/ambari/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/smolnar82/ambari/teams","hooks_url":"https://api.github.com/repos/smolnar82/ambari/hooks","issue_events_url":"https://api.github.com/repos/smolnar82/ambari/issues/events{/number}","events_url":"https://api.github.com/repos/smolnar82/ambari/events","assignees_url":"https://api.github.com/repos/smolnar82/ambari/assignees{/user}","branches_url":"https://api.github.com/repos/smolnar82/ambari/branches{/branch}","tags_url":"https://api.github.com/repos/smolnar82/ambari/tags","blobs_url":"https://api.github.com/repos/smolnar82/ambari/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/smolnar82/ambari/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/smolnar82/ambari/git/refs{/sha}","trees_url":"https://api.github.com/repos/smolnar82/ambari/git/trees{/sha}","statuses_url":"https://api.github.com/repos/smolnar82/ambari/statuses/{sha}","languages_url":"https://api.github.com/repos/smolnar82/ambari/languages","stargazers_url":"https://api.github.com/repos/smolnar82/ambari/stargazers","contributors_url":"https://api.github.com/repos/smolnar82/ambari/contributors","subscribers_url":"https://api.github.com/repos/smolnar82/ambari/subscribers","subscription_url":"https://api.github.com/repos/smolnar82/ambari/subscription","commits_url":"https://api.github.com/repos/smolnar82/ambari/commits{/sha}","git_commits_url":"https://api.github.com/repos/smolnar82/ambari/git/commits{/sha}","comments_url":"https://api.github.com/repos/smolnar82/ambari/comments{/number}","issue_comment_url":"https://api.github.com/repos/smolnar82/ambari/issues/comments{/number}","contents_url":"https://api.github.com/repos/smolnar82/ambari/contents/{+path}","compare_url":"https://api.github.com/repos/smolnar82/ambari/compare/{base}...{head}","merges_url":"https://api.github.com/repos/smolnar82/ambari/merges","archive_url":"https://api.github.com/repos/smolnar82/ambari/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/smolnar82/ambari/downloads","issues_url":"https://api.github.com/repos/smolnar82/ambari/issues{/number}","pulls_url":"https://api.github.com/repos/smolnar82/ambari/pulls{/number}","milestones_url":"https://api.github.com/repos/smolnar82/ambari/milestones{/number}","notifications_url":"https://api.github.com/repos/smolnar82/ambari/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/smolnar82/ambari/labels{/name}","releases_url":"https://api.github.com/repos/smolnar82/ambari/releases{/id}","deployments_url":"https://api.github.com/repos/smolnar82/ambari/deployments","created_at":"2018-01-08T23:46:15Z","updated_at":"2018-04-10T12:58:16Z","pushed_at":"2018-04-10T19:52:10Z","git_url":"git://github.com/smolnar82/ambari.git","ssh_url":"git@github.com:smolnar82/ambari.git","clone_url":"https://github.com/smolnar82/ambari.git","svn_url":"https://github.com/smolnar82/ambari","homepage":null,"size":310994,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"trunk"}},"base":{"label":"apache:trunk","ref":"trunk","sha":"865af311a2887b92cfb88e663c78efcb6a1f0569","user":{"login":"apache","id":47359,"avatar_url":"https://avatars0.githubusercontent.com/u/47359?v=4","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":2442457,"name":"ambari","full_name":"apache/ambari","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars0.githubusercontent.com/u/47359?v=4","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/ambari","description":"Mirror of Apache Ambari","fork":false,"url":"https://api.github.com/repos/apache/ambari","forks_url":"https://api.github.com/repos/apache/ambari/forks","keys_url":"https://api.github.com/repos/apache/ambari/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/ambari/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/ambari/teams","hooks_url":"https://api.github.com/repos/apache/ambari/hooks","issue_events_url":"https://api.github.com/repos/apache/ambari/issues/events{/number}","events_url":"https://api.github.com/repos/apache/ambari/events","assignees_url":"https://api.github.com/repos/apache/ambari/assignees{/user}","branches_url":"https://api.github.com/repos/apache/ambari/branches{/branch}","tags_url":"https://api.github.com/repos/apache/ambari/tags","blobs_url":"https://api.github.com/repos/apache/ambari/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/ambari/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/ambari/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/ambari/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/ambari/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/ambari/languages","stargazers_url":"https://api.github.com/repos/apache/ambari/stargazers","contributors_url":"https://api.github.com/repos/apache/ambari/contributors","subscribers_url":"https://api.github.com/repos/apache/ambari/subscribers","subscription_url":"https://api.github.com/repos/apache/ambari/subscription","commits_url":"https://api.github.com/repos/apache/ambari/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/ambari/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/ambari/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/ambari/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/ambari/contents/{+path}","compare_url":"https://api.github.com/repos/apache/ambari/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/ambari/merges","archive_url":"https://api.github.com/repos/apache/ambari/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/ambari/downloads","issues_url":"https://api.github.com/repos/apache/ambari/issues{/number}","pulls_url":"https://api.github.com/repos/apache/ambari/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/ambari/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/ambari/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/ambari/labels{/name}","releases_url":"https://api.github.com/repos/apache/ambari/releases{/id}","deployments_url":"https://api.github.com/repos/apache/ambari/deployments","created_at":"2011-09-23T07:00:08Z","updated_at":"2018-04-10T20:42:33Z","pushed_at":"2018-04-10T20:42:24Z","git_url":"git://github.com/apache/ambari.git","ssh_url":"git@github.com:apache/ambari.git","clone_url":"https://github.com/apache/ambari.git","svn_url":"https://github.com/apache/ambari","homepage":null,"size":319521,"stargazers_count":800,"watchers_count":800,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":831,"mirror_url":null,"archived":false,"open_issues_count":57,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":831,"open_issues":57,"watchers":800,"default_branch":"trunk"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/ambari/pulls/951"},"html":{"href":"https://github.com/apache/ambari/pull/951"},"issue":{"href":"https://api.github.com/repos/apache/ambari/issues/951"},"comments":{"href":"https://api.github.com/repos/apache/ambari/issues/951/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/ambari/pulls/951/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/ambari/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/ambari/pulls/951/commits"},"statuses":{"href":"https://api.github.com/repos/apache/ambari/statuses/f58129e58e9651bd39672e7f470f0780d9cca4f7"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"smolnar82"}}