[ambari] branch branch-feature-AMBARI-14714 updated (5991237 -> 614f5a7)

2018-03-16 Thread mradhakrishnan
This is an automated email from the ASF dual-hosted git repository.

mradhakrishnan pushed a change to branch branch-feature-AMBARI-14714
in repository https://gitbox.apache.org/repos/asf/ambari.git.


from 5991237  AMBARI-23265 - Provide Original Operating Systems from Mpack 
repoinfo… (#690)
 add f2d2a25  [AMBARI-23223] Stack Mpack link broken in stacks api
 add 7c49e0f  Merge branch 'branch-feature-AMBARI-14714' into AMBARI-23223
 add 4ad157b  [AMBARI-23223] Review comments
 new 614f5a7  Merge pull request #677 from mradha25/AMBARI-23223

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../controller/AmbariManagementControllerImpl.java | 18 --
 .../controller/internal/MpackResourceProvider.java | 72 --
 .../internal/StackVersionResourceProvider.java | 14 ++---
 3 files changed, 59 insertions(+), 45 deletions(-)

-- 
To stop receiving notification emails like this one, please contact
mradhakrish...@apache.org.


[ambari] 01/01: Merge pull request #677 from mradha25/AMBARI-23223

2018-03-16 Thread mradhakrishnan
This is an automated email from the ASF dual-hosted git repository.

mradhakrishnan pushed a commit to branch branch-feature-AMBARI-14714
in repository https://gitbox.apache.org/repos/asf/ambari.git

commit 614f5a7c56511846826084a2b753fef8062c36e8
Merge: 5991237 4ad157b
Author: mradha25 
AuthorDate: Fri Mar 16 13:38:08 2018 -0700

Merge pull request #677 from mradha25/AMBARI-23223

[AMBARI-23223] Stack Mpack link broken in stacks api

 .../controller/AmbariManagementControllerImpl.java | 18 --
 .../controller/internal/MpackResourceProvider.java | 72 --
 .../internal/StackVersionResourceProvider.java | 14 ++---
 3 files changed, 59 insertions(+), 45 deletions(-)


-- 
To stop receiving notification emails like this one, please contact
mradhakrish...@apache.org.


[ambari] branch branch-feature-AMBARI-14714 updated: AMBARI-23265 - Provide Original Operating Systems from Mpack repoinfo… (#690)

2018-03-16 Thread jonathanhurley
This is an automated email from the ASF dual-hosted git repository.

jonathanhurley pushed a commit to branch branch-feature-AMBARI-14714
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-feature-AMBARI-14714 by 
this push:
 new 5991237  AMBARI-23265 - Provide Original Operating Systems from Mpack 
repoinfo… (#690)
5991237 is described below

commit 599123718ead2d5f1a8437061fb068d5a2263ce7
Author: Jonathan Hurley 
AuthorDate: Fri Mar 16 16:03:17 2018 -0400

AMBARI-23265 - Provide Original Operating Systems from Mpack repoinfo… 
(#690)
---
 .../api/resources/MpackResourceDefinition.java |   1 +
 .../api/resources/ResourceInstanceFactoryImpl.java |   5 +
 .../ambari/server/api/services/MpacksService.java  |  16 ++-
 .../api/services/OperatingSystemService.java   |  35 +-
 .../DefaultOperatingSystemResourceProvider.java| 138 +
 .../controller/internal/DefaultProviderModule.java |   2 +
 .../controller/internal/MpackResourceProvider.java |   2 +
 .../internal/OperatingSystemResourceProvider.java  |  11 +-
 .../ambari/server/controller/spi/Resource.java |   2 +
 .../apache/ambari/server/mpack/MpackManager.java   |  30 +++--
 .../java/org/apache/ambari/server/state/Mpack.java |   1 -
 .../ambari/server/state/stack/RepositoryXml.java   |  10 ++
 12 files changed, 229 insertions(+), 24 deletions(-)

diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/api/resources/MpackResourceDefinition.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/MpackResourceDefinition.java
index fc3d5eb..d31d7b7 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/api/resources/MpackResourceDefinition.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/MpackResourceDefinition.java
@@ -57,6 +57,7 @@ public class MpackResourceDefinition extends 
BaseResourceDefinition {
 Set setChildren = new HashSet<>();
 setChildren.add(new SubResourceDefinition(Resource.Type.StackVersion, 
null, false));
 setChildren.add(new SubResourceDefinition(Resource.Type.OperatingSystem, 
null, true));
+setChildren.add(new 
SubResourceDefinition(Resource.Type.DefaultOperatingSystem, null, true));
 return setChildren;
   }
 
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ResourceInstanceFactoryImpl.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ResourceInstanceFactoryImpl.java
index b73f97b..259ef70 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ResourceInstanceFactoryImpl.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ResourceInstanceFactoryImpl.java
@@ -254,6 +254,11 @@ public class ResourceInstanceFactoryImpl implements 
ResourceInstanceFactory {
 resourceDefinition = new ExtensionLinkResourceDefinition();
 break;
 
+  case DefaultOperatingSystem:
+resourceDefinition = new 
SimpleResourceDefinition(Resource.Type.DefaultOperatingSystem,
+"default_operating_system", "default_operating_systems");
+break;
+
   case OperatingSystem:
 resourceDefinition = new OperatingSystemResourceDefinition();
 break;
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/MpacksService.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/MpacksService.java
index dfb90c1..9dda95f 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/MpacksService.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/MpacksService.java
@@ -31,6 +31,7 @@ import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
 
+import org.apache.ambari.annotations.ApiIgnore;
 import org.apache.ambari.server.api.resources.ResourceInstance;
 import org.apache.ambari.server.controller.MpackResponse.MpackResponseWrapper;
 import org.apache.ambari.server.controller.internal.MpackResourceProvider;
@@ -157,13 +158,22 @@ public class MpacksService extends BaseService {
*
* @return operating system service
*/
-  // TODO: find a way to handle this with Swagger (refactor or custom 
annotation?)
+  @ApiIgnore
   @Path("{id}/operating_systems")
-  public OperatingSystemService getOperatingSystemsHandler(
-  @ApiParam @PathParam("id") String mpackId) {
+  public OperatingSystemService getOperatingSystemsHandler(@ApiParam 
@PathParam("id") String mpackId) {
 return new OperatingSystemService(mpackId);
   }
 
+  /**
+   * Handles ANY {id}/default_operating_systems request
+   *
+   * @return operating system service
+   */
+  @ApiIgnore
+  @Path("{id}/default_operating_systems")
+  public OperatingSystemService getDefaultOperatingSystemsHandler(@ApiParam 
@PathParam("id") String mpackId) {
+return new OperatingSystemService(mpackId, 

[ambari] branch trunk updated: AMBARI-23258. Ambari-agent logs are messy/hard to read (aonishuk)

2018-03-16 Thread aonishuk
This is an automated email from the ASF dual-hosted git repository.

aonishuk pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
 new 0907d61  AMBARI-23258. Ambari-agent logs are messy/hard to read 
(aonishuk)
0907d61 is described below

commit 0907d6119f4e1a0f0ae1add6302cd2ad8fe4d149
Author: Andrew Onishuk 
AuthorDate: Fri Mar 16 15:20:16 2018 +0200

AMBARI-23258. Ambari-agent logs are messy/hard to read (aonishuk)
---
 .../python/ambari_agent/AlertStatusReporter.py | 17 -
 .../main/python/ambari_agent/CommandStatusDict.py  | 42 +++---
 .../ambari_agent/CustomServiceOrchestrator.py  |  4 +--
 .../main/python/ambari_agent/HeartbeatThread.py| 16 ++---
 .../main/python/ambari_agent/alerts/ams_alert.py   |  2 +-
 .../python/ambari_agent/alerts/script_alert.py |  2 +-
 .../listeners/AlertDefinitionsEventListener.py | 15 
 .../listeners/CommandsEventListener.py | 19 +-
 .../listeners/ConfigurationEventListener.py| 16 -
 .../listeners/ServerResponsesListener.py   |  8 +
 .../listeners/TopologyEventListener.py | 19 +-
 .../main/python/ambari_agent/listeners/__init__.py |  4 ++-
 ambari-agent/src/main/python/ambari_agent/main.py  |  4 +++
 .../src/main/python/ambari_agent/security.py   |  9 +++--
 .../src/main/python/ambari_stomp/transport.py  |  4 +--
 .../ambari/server/orm/dao/AlertDefinitionDAO.java  |  2 +-
 .../server/orm/entities/AlertDefinitionEntity.java |  3 +-
 .../server/state/alert/AlertDefinitionHash.java|  2 +-
 .../ambari/server/state/alert/AlertHelper.java |  2 +-
 .../ambari/server/alerts/AlertHelperTest.java  |  2 --
 20 files changed, 157 insertions(+), 35 deletions(-)

diff --git a/ambari-agent/src/main/python/ambari_agent/AlertStatusReporter.py 
b/ambari-agent/src/main/python/ambari_agent/AlertStatusReporter.py
index e588bd1..bfb0e4f 100644
--- a/ambari-agent/src/main/python/ambari_agent/AlertStatusReporter.py
+++ b/ambari-agent/src/main/python/ambari_agent/AlertStatusReporter.py
@@ -59,7 +59,7 @@ class AlertStatusReporter(threading.Thread):
   changed_alerts = self.get_changed_alerts(alerts)
 
   if changed_alerts and self.initializer_module.is_registered:
-self.initializer_module.connection.send(message=changed_alerts, 
destination=Constants.ALERTS_STATUS_REPORTS_ENDPOINT)
+self.initializer_module.connection.send(message=changed_alerts, 
destination=Constants.ALERTS_STATUS_REPORTS_ENDPOINT, 
log_message_function=AlertStatusReporter.log_sending)
 self.save_results(changed_alerts)
   except ConnectionIsAlreadyClosed: # server and agent disconnected during 
sending data. Not an issue
 pass
@@ -93,3 +93,18 @@ class AlertStatusReporter(threading.Thread):
 changed_alerts.append(alert)
 
 return changed_alerts
+
+  @staticmethod
+  def log_sending(message_dict):
+"""
+Returned dictionary will be used while logging sent alert status.
+Used because full dict is too big for logs and should be shortened
+"""
+try:
+  for alert_status in message_dict:
+if 'text' in alert_status:
+  alert_status['text'] = '...'
+except KeyError:
+  pass
+  
+return message_dict
diff --git a/ambari-agent/src/main/python/ambari_agent/CommandStatusDict.py 
b/ambari-agent/src/main/python/ambari_agent/CommandStatusDict.py
index d036cbf..0ddc1d9 100644
--- a/ambari-agent/src/main/python/ambari_agent/CommandStatusDict.py
+++ b/ambari-agent/src/main/python/ambari_agent/CommandStatusDict.py
@@ -18,6 +18,7 @@ See the License for the specific language governing 
permissions and
 limitations under the License.
 '''
 
+import os
 import logging
 import threading
 import copy
@@ -76,7 +77,7 @@ class CommandStatusDict():
   return False
 
 try:
-  
self.initializer_module.connection.send(message={'clusters':reports_dict}, 
destination=Constants.COMMANDS_STATUS_REPORTS_ENDPOINT)
+  
self.initializer_module.connection.send(message={'clusters':reports_dict}, 
destination=Constants.COMMANDS_STATUS_REPORTS_ENDPOINT, 
log_message_function=CommandStatusDict.log_sending)
   return True
 except ConnectionIsAlreadyClosed:
   return False
@@ -131,17 +132,18 @@ class CommandStatusDict():
 and populates other fields of report.
 """
 from ActionQueue import ActionQueue
-try:
-  tmpout = open(report['tmpout'], 'r').read()
-  tmperr = open(report['tmperr'], 'r').read()
-except Exception, err:
-  logger.warn(err)
-  tmpout = '...'
-  tmperr = '...'
-try:
-  tmpstructuredout = open(report['structuredOut'], 'r').read()
-except Exception:
-  tmpstructuredout = '{}'
+
+files_to_read = [report['tmpout'], report['tmperr'], 
report['structuredOut']]

[ambari] branch trunk updated: AMBARI-23260. Add reliable way of getting base service/stack_advisor.py file path (echekanskiy)

2018-03-16 Thread echekanskiy
This is an automated email from the ASF dual-hosted git repository.

echekanskiy pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
 new 8440247  AMBARI-23260. Add reliable way of getting base 
service/stack_advisor.py file path (echekanskiy)
8440247 is described below

commit 844024779ccc2c4f31d4bf76bbc7fc113a212490
Author: Eugene Chekanskiy 
AuthorDate: Fri Mar 16 07:54:04 2018 -0400

AMBARI-23260. Add reliable way of getting base service/stack_advisor.py 
file path (echekanskiy)
---
 .../services/stackadvisor/StackAdvisorRunner.java  |  9 +++-
 .../stackadvisor/StackAdvisorRunnerTest.java   | 24 --
 2 files changed, 26 insertions(+), 7 deletions(-)

diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorRunner.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorRunner.java
index 3ba9f6b..556c2c9 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorRunner.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorRunner.java
@@ -20,6 +20,7 @@ package org.apache.ambari.server.api.services.stackadvisor;
 
 import java.io.File;
 import java.io.IOException;
+import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -34,7 +35,6 @@ import org.slf4j.LoggerFactory;
 import com.google.inject.Inject;
 import com.google.inject.Singleton;
 
-
 @Singleton
 public class StackAdvisorRunner {
 
@@ -78,6 +78,9 @@ public class StackAdvisorRunner {
 ProcessBuilder builder = 
prepareShellCommand(ServiceInfo.ServiceAdvisorType.PYTHON, 
StackAdvisorHelper.pythonStackAdvisorScript, saCommandType,
 actionDirectory, outputFile,
 errorFile);
+builder.environment().put("METADATA_DIR_PATH", 
configs.getProperty(Configuration.METADATA_DIR_PATH));
+builder.environment().put("BASE_SERVICE_ADVISOR", 
Paths.get(configs.getProperty(Configuration.METADATA_DIR_PATH), 
"service_advisor.py").toString());
+builder.environment().put("BASE_STACK_ADVISOR", 
Paths.get(configs.getProperty(Configuration.METADATA_DIR_PATH), 
"stack_advisor.py").toString());
 stackAdvisorReturnCode = launchProcess(builder);
 break;
 }
@@ -220,4 +223,8 @@ public class StackAdvisorRunner {
 
 return new ProcessBuilder(builderParameters);
   }
+
+  public void setConfigs(Configuration configs) {
+this.configs = configs;
+  }
 }
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorRunnerTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorRunnerTest.java
index 7eb9fb4..a4fea7c 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorRunnerTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorRunnerTest.java
@@ -26,8 +26,10 @@ import static 
org.powermock.api.support.membermodification.MemberModifier.stub;
 
 import java.io.File;
 import java.io.IOException;
+import java.util.HashMap;
 
 import 
org.apache.ambari.server.api.services.stackadvisor.commands.StackAdvisorCommandType;
+import org.apache.ambari.server.configuration.Configuration;
 import org.apache.ambari.server.state.ServiceInfo;
 import org.junit.After;
 import org.junit.Before;
@@ -64,11 +66,13 @@ public class StackAdvisorRunnerTest {
 File actionDirectory = temp.newFolder("actionDir");
 ProcessBuilder processBuilder = createNiceMock(ProcessBuilder.class);
 StackAdvisorRunner saRunner = new StackAdvisorRunner();
-
+Configuration configMock = createNiceMock(Configuration.class);
+saRunner.setConfigs(configMock);
 stub(PowerMock.method(StackAdvisorRunner.class, "prepareShellCommand"))
 .toReturn(processBuilder);
+expect(processBuilder.environment()).andReturn(new HashMap<>()).times(3);
 expect(processBuilder.start()).andThrow(new IOException());
-replay(processBuilder);
+replay(processBuilder, configMock);
 saRunner.runScript(ServiceInfo.ServiceAdvisorType.PYTHON, saCommandType, 
actionDirectory);
   }
 
@@ -80,12 +84,14 @@ public class StackAdvisorRunnerTest {
 ProcessBuilder processBuilder = createNiceMock(ProcessBuilder.class);
 Process process = createNiceMock(Process.class);
 StackAdvisorRunner saRunner = new StackAdvisorRunner();
-
+Configuration configMock = createNiceMock(Configuration.class);
+saRunner.setConfigs(configMock);
 stub(PowerMock.method(StackAdvisorRunner.class, "prepareShellCommand"))
 .toReturn(processBuilder);
+expect(processBuilder.environment()).andReturn(new HashMap<>()).times(3);
 

[ambari] branch branch-feature-AMBARI-14714 updated: [AMBARI-23227] Pass service_group_name and service_name while creating Host Components. (#662)

2018-03-16 Thread ishanbha
This is an automated email from the ASF dual-hosted git repository.

ishanbha pushed a commit to branch branch-feature-AMBARI-14714
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-feature-AMBARI-14714 by 
this push:
 new 128afd2  [AMBARI-23227] Pass service_group_name and service_name while 
creating Host Components. (#662)
128afd2 is described below

commit 128afd2f3a3c58fdd84c58b38e50e0d3526c373b
Author: Ishan Bhatt 
AuthorDate: Fri Mar 16 08:39:00 2018 -0700

[AMBARI-23227] Pass service_group_name and service_name while creating Host 
Components. (#662)
---
 .../app/controllers/wizard/step8_controller.js | 42 --
 ambari-web/test/controllers/wizard/step4_test.js   |  2 ++
 2 files changed, 25 insertions(+), 19 deletions(-)

diff --git a/ambari-web/app/controllers/wizard/step8_controller.js 
b/ambari-web/app/controllers/wizard/step8_controller.js
index c2b5f9e..a780700 100644
--- a/ambari-web/app/controllers/wizard/step8_controller.js
+++ b/ambari-web/app/controllers/wizard/step8_controller.js
@@ -1198,7 +1198,6 @@ App.WizardStep8Controller = 
App.WizardStepController.extend(App.AddSecurityConfi
 }, this);
 selectedMasterComponents.mapProperty('component').uniq().forEach(function 
(component) {
   var hostNames = [];
-  let serviceName = 
App.StackServiceComponent.find().findProperty('componentName', 
component).get('serviceName');
   if (masterOnAllHosts.length > 0) {
 var compOnAllHosts = false;
 for (var i=0; i < masterOnAllHosts.length; i++) {
@@ -1209,11 +1208,11 @@ App.WizardStep8Controller = 
App.WizardStepController.extend(App.AddSecurityConfi
 }
 if (!compOnAllHosts) {
   hostNames = selectedMasterComponents.filterProperty('component', 
component).filterProperty('isInstalled', false).mapProperty('hostName');
-  this.registerHostsToComponent(hostNames, component, serviceName);
+  this.registerHostsToComponent(hostNames, component);
 }
   } else {
 hostNames = selectedMasterComponents.filterProperty('component', 
component).filterProperty('isInstalled', false).mapProperty('hostName');
-this.registerHostsToComponent(hostNames, component, serviceName);
+this.registerHostsToComponent(hostNames, component);
   }
 }, this);
   },
@@ -1275,7 +1274,6 @@ App.WizardStep8Controller = 
App.WizardStepController.extend(App.AddSecurityConfi
   var hostNames = [];
   var compOnAllHosts;
   if (_slave.componentName !== 'CLIENT') {
-let serviceName = 
App.StackServiceComponent.find().findProperty('componentName', 
_slave.componentName).get('serviceName');
 if (slaveOnAllHosts.length > 0) {
   compOnAllHosts = false;
   for (var i=0; i < slaveOnAllHosts.length; i++) {
@@ -1288,18 +1286,16 @@ App.WizardStep8Controller = 
App.WizardStepController.extend(App.AddSecurityConfi
   }
   if (!compOnAllHosts) {
 hostNames = _slave.hosts.filterProperty('isInstalled', 
false).mapProperty('hostName');
-this.registerHostsToComponent(hostNames, _slave.componentName, 
serviceName);
+this.registerHostsToComponent(hostNames, _slave.componentName);
   }
 } else {
   hostNames = _slave.hosts.filterProperty('isInstalled', 
false).mapProperty('hostName');
-  this.registerHostsToComponent(hostNames, _slave.componentName, 
serviceName);
+  this.registerHostsToComponent(hostNames, _slave.componentName);
 }
   }
   else {
 clients.forEach(function (_client) {
   hostNames = _slave.hosts.mapProperty('hostName');
-  let compName = _client.component_name
-  let serviceName = 
App.StackServiceComponent.find().findProperty('componentName', 
compName).get('serviceName')
   // The below logic to install clients to existing/New master hosts 
should not be applied to Add Host wizard.
   // This is with the presumption that Add Host controller does not 
add any new Master component to the cluster
   if (!this.get('isAddHost')) {
@@ -1330,11 +1326,11 @@ App.WizardStep8Controller = 
App.WizardStepController.extend(App.AddSecurityConfi
 }
 if (!compOnAllHosts) {
   hostNames = hostNames.uniq();
-  this.registerHostsToComponent(hostNames, _client.component_name, 
serviceName);
+  this.registerHostsToComponent(hostNames, _client.component_name);
 }
   } else {
 hostNames = hostNames.uniq();
-this.registerHostsToComponent(hostNames, _client.component_name, 
serviceName);
+this.registerHostsToComponent(hostNames, _client.component_name);
   }
 }, this);
   }
@@ -1391,8 +1387,7 @@ App.WizardStep8Controller = 
App.WizardStepController.extend(App.AddSecurityConfi
   // 

[ambari] branch trunk updated: Revert "AMBARI-23258. Ambari-agent logs are messy/hard to read (aonishuk)"

2018-03-16 Thread aonishuk
This is an automated email from the ASF dual-hosted git repository.

aonishuk pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
 new 82f1925  Revert "AMBARI-23258. Ambari-agent logs are messy/hard to 
read (aonishuk)"
82f1925 is described below

commit 82f192516fad8cc72dda2c5d2d92363ded8003ea
Author: aonishuk 
AuthorDate: Fri Mar 16 15:13:58 2018 +0200

Revert "AMBARI-23258. Ambari-agent logs are messy/hard to read (aonishuk)"

This reverts commit 668e397993bfe08314b731dcd5affcca5d398d7f.
---
 .../python/ambari_agent/AlertStatusReporter.py | 17 +
 .../main/python/ambari_agent/CommandStatusDict.py  | 42 +++---
 .../ambari_agent/CustomServiceOrchestrator.py  |  4 +--
 .../main/python/ambari_agent/HeartbeatThread.py| 16 +++--
 .../main/python/ambari_agent/alerts/ams_alert.py   |  2 +-
 .../python/ambari_agent/alerts/script_alert.py |  2 +-
 .../listeners/AlertDefinitionsEventListener.py | 15 
 .../listeners/CommandsEventListener.py | 19 +-
 .../listeners/ConfigurationEventListener.py| 16 +
 .../listeners/ServerResponsesListener.py   |  8 -
 .../listeners/TopologyEventListener.py | 19 +-
 .../main/python/ambari_agent/listeners/__init__.py |  4 +--
 ambari-agent/src/main/python/ambari_agent/main.py  |  4 ---
 .../src/main/python/ambari_agent/security.py   |  9 ++---
 .../src/main/python/ambari_stomp/transport.py  |  4 +--
 .../ambari/server/agent/ExecutionCommand.java  |  1 -
 .../ambari/server/orm/dao/AlertDefinitionDAO.java  |  2 +-
 .../server/orm/entities/AlertDefinitionEntity.java |  3 +-
 .../server/state/alert/AlertDefinitionHash.java|  2 +-
 .../ambari/server/state/alert/AlertHelper.java |  2 +-
 .../ambari/server/alerts/AlertHelperTest.java  |  2 ++
 21 files changed, 35 insertions(+), 158 deletions(-)

diff --git a/ambari-agent/src/main/python/ambari_agent/AlertStatusReporter.py 
b/ambari-agent/src/main/python/ambari_agent/AlertStatusReporter.py
index bfb0e4f..e588bd1 100644
--- a/ambari-agent/src/main/python/ambari_agent/AlertStatusReporter.py
+++ b/ambari-agent/src/main/python/ambari_agent/AlertStatusReporter.py
@@ -59,7 +59,7 @@ class AlertStatusReporter(threading.Thread):
   changed_alerts = self.get_changed_alerts(alerts)
 
   if changed_alerts and self.initializer_module.is_registered:
-self.initializer_module.connection.send(message=changed_alerts, 
destination=Constants.ALERTS_STATUS_REPORTS_ENDPOINT, 
log_message_function=AlertStatusReporter.log_sending)
+self.initializer_module.connection.send(message=changed_alerts, 
destination=Constants.ALERTS_STATUS_REPORTS_ENDPOINT)
 self.save_results(changed_alerts)
   except ConnectionIsAlreadyClosed: # server and agent disconnected during 
sending data. Not an issue
 pass
@@ -93,18 +93,3 @@ class AlertStatusReporter(threading.Thread):
 changed_alerts.append(alert)
 
 return changed_alerts
-
-  @staticmethod
-  def log_sending(message_dict):
-"""
-Returned dictionary will be used while logging sent alert status.
-Used because full dict is too big for logs and should be shortened
-"""
-try:
-  for alert_status in message_dict:
-if 'text' in alert_status:
-  alert_status['text'] = '...'
-except KeyError:
-  pass
-  
-return message_dict
diff --git a/ambari-agent/src/main/python/ambari_agent/CommandStatusDict.py 
b/ambari-agent/src/main/python/ambari_agent/CommandStatusDict.py
index 0ddc1d9..d036cbf 100644
--- a/ambari-agent/src/main/python/ambari_agent/CommandStatusDict.py
+++ b/ambari-agent/src/main/python/ambari_agent/CommandStatusDict.py
@@ -18,7 +18,6 @@ See the License for the specific language governing 
permissions and
 limitations under the License.
 '''
 
-import os
 import logging
 import threading
 import copy
@@ -77,7 +76,7 @@ class CommandStatusDict():
   return False
 
 try:
-  
self.initializer_module.connection.send(message={'clusters':reports_dict}, 
destination=Constants.COMMANDS_STATUS_REPORTS_ENDPOINT, 
log_message_function=CommandStatusDict.log_sending)
+  
self.initializer_module.connection.send(message={'clusters':reports_dict}, 
destination=Constants.COMMANDS_STATUS_REPORTS_ENDPOINT)
   return True
 except ConnectionIsAlreadyClosed:
   return False
@@ -132,18 +131,17 @@ class CommandStatusDict():
 and populates other fields of report.
 """
 from ActionQueue import ActionQueue
-
-files_to_read = [report['tmpout'], report['tmperr'], 
report['structuredOut']]
-files_content = ['...', '...', '{}']
-
-for i in xrange(len(files_to_read)):
-  filename = files_to_read[i]
-  if os.path.exists(filename):
-with open(filename, 'r') as fp:

[ambari] branch revert-683-AMBARI-23258-trunk deleted (was d98abd7)

2018-03-16 Thread aonishuk
This is an automated email from the ASF dual-hosted git repository.

aonishuk pushed a change to branch revert-683-AMBARI-23258-trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git.


 was d98abd7  Revert "AMBARI-23258. Ambari-agent logs are messy/hard to 
read (aonishuk)"

The revisions that were on this branch are still contained in
other references; therefore, this change does not discard any commits
from the repository.

-- 
To stop receiving notification emails like this one, please contact
aonis...@apache.org.


[ambari] branch trunk updated: AMBARI-23258. Ambari-agent logs are messy/hard to read (aonishuk)

2018-03-16 Thread aonishuk
This is an automated email from the ASF dual-hosted git repository.

aonishuk pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
 new 668e397  AMBARI-23258. Ambari-agent logs are messy/hard to read 
(aonishuk)
668e397 is described below

commit 668e397993bfe08314b731dcd5affcca5d398d7f
Author: Andrew Onishuk 
AuthorDate: Fri Mar 16 13:26:57 2018 +0200

AMBARI-23258. Ambari-agent logs are messy/hard to read (aonishuk)
---
 .../python/ambari_agent/AlertStatusReporter.py | 17 -
 .../main/python/ambari_agent/CommandStatusDict.py  | 42 +++---
 .../ambari_agent/CustomServiceOrchestrator.py  |  4 +--
 .../main/python/ambari_agent/HeartbeatThread.py| 16 ++---
 .../main/python/ambari_agent/alerts/ams_alert.py   |  2 +-
 .../python/ambari_agent/alerts/script_alert.py |  2 +-
 .../listeners/AlertDefinitionsEventListener.py | 15 
 .../listeners/CommandsEventListener.py | 19 +-
 .../listeners/ConfigurationEventListener.py| 16 -
 .../listeners/ServerResponsesListener.py   |  8 +
 .../listeners/TopologyEventListener.py | 19 +-
 .../main/python/ambari_agent/listeners/__init__.py |  4 ++-
 ambari-agent/src/main/python/ambari_agent/main.py  |  4 +++
 .../src/main/python/ambari_agent/security.py   |  9 +++--
 .../src/main/python/ambari_stomp/transport.py  |  4 +--
 .../ambari/server/agent/ExecutionCommand.java  |  1 +
 .../ambari/server/orm/dao/AlertDefinitionDAO.java  |  2 +-
 .../server/orm/entities/AlertDefinitionEntity.java |  3 +-
 .../server/state/alert/AlertDefinitionHash.java|  2 +-
 .../ambari/server/state/alert/AlertHelper.java |  2 +-
 .../ambari/server/alerts/AlertHelperTest.java  |  2 --
 21 files changed, 158 insertions(+), 35 deletions(-)

diff --git a/ambari-agent/src/main/python/ambari_agent/AlertStatusReporter.py 
b/ambari-agent/src/main/python/ambari_agent/AlertStatusReporter.py
index e588bd1..bfb0e4f 100644
--- a/ambari-agent/src/main/python/ambari_agent/AlertStatusReporter.py
+++ b/ambari-agent/src/main/python/ambari_agent/AlertStatusReporter.py
@@ -59,7 +59,7 @@ class AlertStatusReporter(threading.Thread):
   changed_alerts = self.get_changed_alerts(alerts)
 
   if changed_alerts and self.initializer_module.is_registered:
-self.initializer_module.connection.send(message=changed_alerts, 
destination=Constants.ALERTS_STATUS_REPORTS_ENDPOINT)
+self.initializer_module.connection.send(message=changed_alerts, 
destination=Constants.ALERTS_STATUS_REPORTS_ENDPOINT, 
log_message_function=AlertStatusReporter.log_sending)
 self.save_results(changed_alerts)
   except ConnectionIsAlreadyClosed: # server and agent disconnected during 
sending data. Not an issue
 pass
@@ -93,3 +93,18 @@ class AlertStatusReporter(threading.Thread):
 changed_alerts.append(alert)
 
 return changed_alerts
+
+  @staticmethod
+  def log_sending(message_dict):
+"""
+Returned dictionary will be used while logging sent alert status.
+Used because full dict is too big for logs and should be shortened
+"""
+try:
+  for alert_status in message_dict:
+if 'text' in alert_status:
+  alert_status['text'] = '...'
+except KeyError:
+  pass
+  
+return message_dict
diff --git a/ambari-agent/src/main/python/ambari_agent/CommandStatusDict.py 
b/ambari-agent/src/main/python/ambari_agent/CommandStatusDict.py
index d036cbf..0ddc1d9 100644
--- a/ambari-agent/src/main/python/ambari_agent/CommandStatusDict.py
+++ b/ambari-agent/src/main/python/ambari_agent/CommandStatusDict.py
@@ -18,6 +18,7 @@ See the License for the specific language governing 
permissions and
 limitations under the License.
 '''
 
+import os
 import logging
 import threading
 import copy
@@ -76,7 +77,7 @@ class CommandStatusDict():
   return False
 
 try:
-  
self.initializer_module.connection.send(message={'clusters':reports_dict}, 
destination=Constants.COMMANDS_STATUS_REPORTS_ENDPOINT)
+  
self.initializer_module.connection.send(message={'clusters':reports_dict}, 
destination=Constants.COMMANDS_STATUS_REPORTS_ENDPOINT, 
log_message_function=CommandStatusDict.log_sending)
   return True
 except ConnectionIsAlreadyClosed:
   return False
@@ -131,17 +132,18 @@ class CommandStatusDict():
 and populates other fields of report.
 """
 from ActionQueue import ActionQueue
-try:
-  tmpout = open(report['tmpout'], 'r').read()
-  tmperr = open(report['tmperr'], 'r').read()
-except Exception, err:
-  logger.warn(err)
-  tmpout = '...'
-  tmperr = '...'
-try:
-  tmpstructuredout = open(report['structuredOut'], 'r').read()
-except Exception:
-  tmpstructuredout = '{}'
+
+files_to_read = 

[ambari] 01/01: Merge pull request #658 from dlysnichenko/AMBARI-23234_trunk

2018-03-16 Thread dmitriusan
This is an automated email from the ASF dual-hosted git repository.

dmitriusan pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git

commit cd914c5e320c0af79d8c7765936e45d859ca608a
Merge: 8de19af 2c0b96f
Author: Lisnichenko Dmitro 
AuthorDate: Fri Mar 16 08:43:15 2018 +0200

Merge pull request #658 from dlysnichenko/AMBARI-23234_trunk

AMBARI-23234. Issue with zeppelin after upgrade (dlysnichenko)

 .../serveraction/upgrades/FixNotebookStorage.java  | 26 --
 1 file changed, 19 insertions(+), 7 deletions(-)

-- 
To stop receiving notification emails like this one, please contact
dmitriu...@apache.org.


[ambari] branch trunk updated (8de19af -> cd914c5)

2018-03-16 Thread dmitriusan
This is an automated email from the ASF dual-hosted git repository.

dmitriusan pushed a change to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git.


from 8de19af  AMBARI-23024 Log Search UI: Implement Metadata patterns screen
 add 5d721d9  AMBARI-23234. Issue with zeppelin after upgrade (dlysnichenko)
 add 2c0b96f  AMBARI-23234. Issue with zeppelin after upgrade. Additional 
changes (dlysnichenko)
 new cd914c5  Merge pull request #658 from dlysnichenko/AMBARI-23234_trunk

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../serveraction/upgrades/FixNotebookStorage.java  | 26 --
 1 file changed, 19 insertions(+), 7 deletions(-)

-- 
To stop receiving notification emails like this one, please contact
dmitriu...@apache.org.