You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ab...@apache.org on 2015/04/24 19:04:38 UTC
[2/3] ambari git commit: AMBARI-10660 - Need to relocate
stacks/HDPWIN/2.1/services/STORM/package/alerts/check_supervisor_process.py
(Eugene Chekanskiy via abaranchuk)
AMBARI-10660 - Need to relocate stacks/HDPWIN/2.1/services/STORM/package/alerts/check_supervisor_process.py (Eugene Chekanskiy via abaranchuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/43c8cd49
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/43c8cd49
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/43c8cd49
Branch: refs/heads/trunk
Commit: 43c8cd496c8521f32f2bdebef296f54b37061ce7
Parents: eae822f
Author: Artem Baranchuk <ab...@hortonworks.con>
Authored: Fri Apr 24 20:01:42 2015 +0300
Committer: Artem Baranchuk <ab...@hortonworks.con>
Committed: Fri Apr 24 20:01:42 2015 +0300
----------------------------------------------------------------------
.../alerts/check_supervisor_process_win.py | 49 ++++++++++++++++++++
.../STORM/0.9.1.2.1/package/scripts/nimbus.py | 3 +-
.../0.9.1.2.1/package/scripts/supervisor.py | 2 +
.../0.9.1.2.1/package/scripts/ui_server.py | 2 +
.../0.9.1.2.1/package/scripts/yaml_utils.py | 4 +-
.../HDPWIN/2.1/services/STORM/alerts.json | 2 +-
.../package/alerts/check_supervisor_process.py | 49 --------------------
7 files changed, 59 insertions(+), 52 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/43c8cd49/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/alerts/check_supervisor_process_win.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/alerts/check_supervisor_process_win.py b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/alerts/check_supervisor_process_win.py
new file mode 100644
index 0000000..dcae64a
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/alerts/check_supervisor_process_win.py
@@ -0,0 +1,49 @@
+#!/usr/bin/env python
+
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+"""
+
+from resource_management.libraries.functions import check_windows_service_status
+
+
+RESULT_CODE_OK = 'OK'
+RESULT_CODE_CRITICAL = 'CRITICAL'
+RESULT_CODE_UNKNOWN = 'UNKNOWN'
+
+
+def get_tokens():
+ """
+ Returns a tuple of tokens in the format {{site/property}} that will be used
+ to build the dictionary passed into execute
+ """
+ return ()
+
+def execute(parameters=None, host_name=None):
+ """
+ Returns a tuple containing the result code and a pre-formatted result label
+
+ Keyword arguments:
+ parameters (dictionary): a mapping of parameter key to value
+ host_name (string): the name of this host where the alert is running
+ """
+
+ try:
+ check_windows_service_status("supervisor")
+ return (RESULT_CODE_OK, ["Supervisor is running"])
+ except:
+ return (RESULT_CODE_CRITICAL, ["Supervisor is stopped"])
http://git-wip-us.apache.org/repos/asf/ambari/blob/43c8cd49/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/nimbus.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/nimbus.py b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/nimbus.py
index 98e9e9b..57db32d 100644
--- a/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/nimbus.py
+++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/nimbus.py
@@ -32,7 +32,7 @@ from resource_management.libraries.functions.security_commons import build_expec
from setup_ranger_storm import setup_ranger_storm
from ambari_commons import OSConst
from ambari_commons.os_family_impl import OsFamilyImpl
-
+from resource_management.core.resources.service import Service
class Nimbus(Script):
def install(self, env):
@@ -132,6 +132,7 @@ class NimbusWindows(Nimbus):
def status(self, env):
import status_params
+ from resource_management.libraries.functions.windows_service_utils import check_windows_service_status
env.set_params(status_params)
check_windows_service_status(status_params.nimbus_win_service_name)
http://git-wip-us.apache.org/repos/asf/ambari/blob/43c8cd49/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/supervisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/supervisor.py b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/supervisor.py
index 0005efa..4acfd80 100644
--- a/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/supervisor.py
+++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/supervisor.py
@@ -28,6 +28,7 @@ from storm import storm
from service import service
from ambari_commons import OSConst
from ambari_commons.os_family_impl import OsFamilyImpl
+from resource_management.core.resources.service import Service
class Supervisor(Script):
@@ -56,6 +57,7 @@ class SupervisorWindows(Supervisor):
def status(self, env):
import status_params
+ from resource_management.libraries.functions.windows_service_utils import check_windows_service_status
env.set_params(status_params)
check_windows_service_status(status_params.supervisor_win_service_name)
http://git-wip-us.apache.org/repos/asf/ambari/blob/43c8cd49/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/ui_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/ui_server.py b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/ui_server.py
index bd09ffe..172a357 100644
--- a/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/ui_server.py
+++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/ui_server.py
@@ -33,6 +33,7 @@ from resource_management.libraries.functions.security_commons import build_expec
from setup_ranger_storm import setup_ranger_storm
from ambari_commons import OSConst
from ambari_commons.os_family_impl import OsFamilyImpl
+from resource_management.core.resources.service import Service
class UiServer(Script):
@@ -61,6 +62,7 @@ class UiServerWindows(UiServer):
def status(self, env):
import status_params
env.set_params(status_params)
+ from resource_management.libraries.functions.windows_service_utils import check_windows_service_status
check_windows_service_status(status_params.ui_win_service_name)
http://git-wip-us.apache.org/repos/asf/ambari/blob/43c8cd49/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/yaml_utils.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/yaml_utils.py b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/yaml_utils.py
index 51ad670..aeda3b3 100644
--- a/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/yaml_utils.py
+++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/yaml_utils.py
@@ -19,8 +19,10 @@ limitations under the License.
"""
import re
+import os
import resource_management
from resource_management.core.source import InlineTemplate
+from resource_management.core.resources.system import File
def escape_yaml_propetry(value):
unquouted = False
@@ -69,7 +71,7 @@ def yaml_config_template(configurations):
def yaml_config(filename, configurations = None, conf_dir = None, owner = None, group = None):
import params
- config_content = source.InlineTemplate('''{% for key, value in configurations_dict.items() %}{{ key }}: {{ escape_yaml_propetry(value) }}
+ config_content = InlineTemplate('''{% for key, value in configurations_dict.items() %}{{ key }}: {{ escape_yaml_propetry(value) }}
{% endfor %}''', configurations_dict=configurations, extra_imports=[escape_yaml_propetry])
File (os.path.join(params.conf_dir, filename),
http://git-wip-us.apache.org/repos/asf/ambari/blob/43c8cd49/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/STORM/alerts.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/STORM/alerts.json b/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/STORM/alerts.json
index babf7cf..e5d4e47 100644
--- a/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/STORM/alerts.json
+++ b/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/STORM/alerts.json
@@ -166,7 +166,7 @@
"scope": "HOST",
"source": {
"type": "SCRIPT",
- "path": "HDPWIN/2.1/services/STORM/package/alerts/check_supervisor_process.py"
+ "path": "STORM/0.9.1.2.1/package/alerts/check_supervisor_process_win.py"
}
}
]
http://git-wip-us.apache.org/repos/asf/ambari/blob/43c8cd49/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/STORM/package/alerts/check_supervisor_process.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/STORM/package/alerts/check_supervisor_process.py b/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/STORM/package/alerts/check_supervisor_process.py
deleted file mode 100644
index dcae64a..0000000
--- a/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/STORM/package/alerts/check_supervisor_process.py
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/usr/bin/env python
-
-"""
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-"""
-
-from resource_management.libraries.functions import check_windows_service_status
-
-
-RESULT_CODE_OK = 'OK'
-RESULT_CODE_CRITICAL = 'CRITICAL'
-RESULT_CODE_UNKNOWN = 'UNKNOWN'
-
-
-def get_tokens():
- """
- Returns a tuple of tokens in the format {{site/property}} that will be used
- to build the dictionary passed into execute
- """
- return ()
-
-def execute(parameters=None, host_name=None):
- """
- Returns a tuple containing the result code and a pre-formatted result label
-
- Keyword arguments:
- parameters (dictionary): a mapping of parameter key to value
- host_name (string): the name of this host where the alert is running
- """
-
- try:
- check_windows_service_status("supervisor")
- return (RESULT_CODE_OK, ["Supervisor is running"])
- except:
- return (RESULT_CODE_CRITICAL, ["Supervisor is stopped"])