You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ao...@apache.org on 2014/01/10 15:40:47 UTC
git commit: AMBARI-4259. Create curl script for testing Storm and
Falcon (aonishuk)
Updated Branches:
refs/heads/trunk bbccf1226 -> 7b8a705ca
AMBARI-4259. Create curl script for testing Storm and Falcon (aonishuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/7b8a705c
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/7b8a705c
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/7b8a705c
Branch: refs/heads/trunk
Commit: 7b8a705caae019f04a518ffb95224f654d5b822b
Parents: bbccf12
Author: Andrew Onischuk <ao...@hortonworks.com>
Authored: Fri Jan 10 06:29:17 2014 -0800
Committer: Andrew Onischuk <ao...@hortonworks.com>
Committed: Fri Jan 10 06:34:20 2014 -0800
----------------------------------------------------------------------
.../main/resources/scripts/add_service_api.py | 121 +++++++++++++++++++
.../src/main/resources/scripts/configs.sh | 2 +-
.../HDP/2.0.8/services/STORM/package/nimbus.py | 68 -----------
.../HDP/2.0.8/services/STORM/package/params.py | 25 ----
.../services/STORM/package/scripts/nimbus.py | 68 +++++++++++
.../services/STORM/package/scripts/params.py | 25 ++++
.../STORM/package/scripts/status_params.py | 19 +++
.../STORM/package/scripts/supervisor.py | 78 ++++++++++++
.../STORM/package/scripts/yaml_config.py | 19 +++
.../services/STORM/package/status_params.py | 19 ---
.../2.0.8/services/STORM/package/supervisor.py | 78 ------------
.../2.0.8/services/STORM/package/yaml_config.py | 19 ---
12 files changed, 331 insertions(+), 210 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/7b8a705c/ambari-server/src/main/resources/scripts/add_service_api.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/scripts/add_service_api.py b/ambari-server/src/main/resources/scripts/add_service_api.py
new file mode 100644
index 0000000..4f06718
--- /dev/null
+++ b/ambari-server/src/main/resources/scripts/add_service_api.py
@@ -0,0 +1,121 @@
+#!/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.
+'''
+# MUST be run on ambari-server host
+import json
+import time
+from resource_management.core.shell import checked_call, call
+
+# Change this to hostname of your ambari-server
+HOSTNAME = checked_call("hostname -f")[1].strip()
+
+############# Configurations (feel free to change) #############
+
+SERVICE_NAME = "STORM"
+
+COMPONENTS = [
+ "NIMBUS",
+ "SUPERVISOR"
+]
+
+COMPONENTS_TO_HOSTS = {
+ "NIMBUS": HOSTNAME,
+ "SUPERVISOR": HOSTNAME,
+ #"SUPERVISOR": "dev01.hortonworks.com"
+}
+
+PROTOCOL = "http"
+PORT = "8080"
+
+CLUSTER_NAME = "c1"
+STACK_VERSION = "2.0.8"
+
+CONFIGS_TO_CHANGE = {
+ "storm-site":{
+ "nimbus.host":HOSTNAME
+ },
+ #"global":{
+ # "clientPort":"2182"
+ #}
+}
+
+#################################################################
+SERVER_URL = "{protocol}://{hostname}:{port}".format(protocol=PROTOCOL, hostname=HOSTNAME, port=PORT)
+
+def main():
+ # add service
+ checked_call('curl -H \'X-Requested-By:anything\' -i -X POST -d \'[{{"ServiceInfo":{{"service_name":"{service_name}"}}}}]\' -u admin:admin {server_url}/api/v1/clusters/{cluster_name}/services'.
+ format(service_name=SERVICE_NAME, server_url=SERVER_URL, cluster_name=CLUSTER_NAME))
+
+ # add components
+ for component in COMPONENTS:
+ checked_call('curl -H \'X-Requested-By:anything\' -i -X POST -d \'{{"components":[{{"ServiceComponentInfo":{{"component_name":"{component}"}}}}]}}\' -u admin:admin {server_url}/api/v1/clusters/{cluster_name}/services?ServiceInfo/service_name={service_name}'.
+ format(service_name=SERVICE_NAME, component=component, server_url=SERVER_URL, cluster_name=CLUSTER_NAME))
+
+ # assign components to hosts
+ for component, host in COMPONENTS_TO_HOSTS.iteritems():
+ checked_call('curl -H \'X-Requested-By:anything\' -i -X POST -d \'{{"host_components":[{{"HostRoles":{{"component_name":"{component}"}}}}]}}\' -u admin:admin {server_url}/api/v1/clusters/{cluster_name}/hosts?Hosts/host_name={host}'.
+ format(host=host, component=component, server_url=SERVER_URL, cluster_name=CLUSTER_NAME))
+
+ # update and create all the service-specific configurations
+ checked_call('curl -H \'X-Requested-By:anything\'-X GET -u admin:admin {server_url}/api/v1/stacks2/HDP/versions/{stack_version}/stackServices/{service_name}/configurations?fields=* > /tmp/config.json'.
+ format(server_url=SERVER_URL, stack_version=STACK_VERSION, service_name=SERVICE_NAME))
+ with open('/tmp/config.json', "r") as f:
+ d = json.load(f)
+
+ configs = {}
+ for x in d['items']:
+ site_name = x['StackConfigurations']['type'][:-4]
+ if not site_name in configs:
+ configs[site_name] = {}
+ config = configs[site_name]
+ config[x['StackConfigurations']['property_name']] = x['StackConfigurations']['property_value']
+
+ for site_name, site_content in configs.iteritems():
+ code = call('/var/lib/ambari-server/resources/scripts/configs.sh get {hostname} {cluster_name} {site_name}'.format(hostname=HOSTNAME, cluster_name=CLUSTER_NAME, site_name=site_name))[0]
+
+ if code:
+ print "Adding new site: "+site_name
+ checked_call('curl -i -H \'X-Requested-By:anything\' -X PUT -d \'{{"Clusters":{{"desired_configs":{{"type":"{site_name}","tag":"version1","properties":{site_content}}}}}}}\' -u admin:admin {server_url}/api/v1/clusters/{cluster_name}'.format(site_name=site_name, site_content=json.dumps(site_content), server_url=SERVER_URL, cluster_name=CLUSTER_NAME))
+ else:
+ timestamp = int(time.time())
+ print "Modifiying site: "+site_name+" version"+str(timestamp)
+ checked_call('/var/lib/ambari-server/resources/scripts/configs.sh get {hostname} {cluster_name} {site_name} /tmp/current_site.json'.format(hostname=HOSTNAME, cluster_name=CLUSTER_NAME, site_name=site_name))
+
+ with open('/tmp/current_site.json', "r") as f:
+ fcontent = f.read()
+ d = json.loads("{"+fcontent+"}")
+
+ for k,v in site_content.iteritems():
+ d['properties'][k] = v
+
+ checked_call('curl -i -H \'X-Requested-By:anything\' -X PUT -d \'{{"Clusters":{{"desired_configs":{{"type":"{site_name}","tag":"version{timestamp}","properties":{site_content}}}}}}}\' -u admin:admin {server_url}/api/v1/clusters/{cluster_name}'.format(site_name=site_name, timestamp=timestamp, site_content=json.dumps(d['properties']), server_url=SERVER_URL, cluster_name=CLUSTER_NAME))
+
+ for site_name, site_configs in CONFIGS_TO_CHANGE.iteritems():
+ for config_name, config_value in site_configs.iteritems():
+ print "Adding config "+config_name+"="+config_value+" to "+site_name
+ checked_call('/var/lib/ambari-server/resources/scripts/configs.sh set {hostname} {cluster_name} {site_name} {config_name} {config_value}'.format(config_name=config_name, config_value=config_value, hostname=HOSTNAME, cluster_name=CLUSTER_NAME, site_name=site_name))
+
+
+ # install all new components
+ checked_call('curl -H \'X-Requested-By:anything\' -i -X PUT -d \'{{"RequestInfo": {{"context" :"Installing Services"}}, "Body": {{"ServiceInfo": {{"state": "INSTALLED"}}}}}}\' -u admin:admin {server_url}/api/v1/clusters/{cluster_name}/services?ServiceInfo/state=INIT'.
+ format(server_url=SERVER_URL, cluster_name=CLUSTER_NAME))
+
+if __name__ == '__main__':
+ main()
http://git-wip-us.apache.org/repos/asf/ambari/blob/7b8a705c/ambari-server/src/main/resources/scripts/configs.sh
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/scripts/configs.sh b/ambari-server/src/main/resources/scripts/configs.sh
index 401c5f9..4e80dca 100755
--- a/ambari-server/src/main/resources/scripts/configs.sh
+++ b/ambari-server/src/main/resources/scripts/configs.sh
@@ -160,7 +160,7 @@ doConfigFileUpdate () {
newTag="version${newTag}000"
newProperties=`cat $FILENAME`;
finalJson="{ \"Clusters\": { \"desired_config\": {\"type\": \"$SITE\", \"tag\":\"$newTag\", $newProperties}}}"
- newFile="PUT_$FILENAME"
+ newFile="$FILENAME"
echo $finalJson>$newFile
echo "########## PUTting file:\"$FILENAME\" into config(type:\"$SITE\", tag:$newTag) via $newFile"
curl -u $USERID:$PASSWD -X PUT -H "X-Requested-By: ambari" "$AMBARIURL/api/v1/clusters/$CLUSTER" --data @$newFile
http://git-wip-us.apache.org/repos/asf/ambari/blob/7b8a705c/ambari-server/src/main/resources/stacks/HDP/2.0.8/services/STORM/package/nimbus.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.8/services/STORM/package/nimbus.py b/ambari-server/src/main/resources/stacks/HDP/2.0.8/services/STORM/package/nimbus.py
deleted file mode 100644
index 6ed1e39..0000000
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.8/services/STORM/package/nimbus.py
+++ /dev/null
@@ -1,68 +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.
-
-"""
-
-import sys
-from resource_management import *
-
-
-class Nimbus(Script):
- def install(self, env):
- self.install_packages(env)
- self.configure(env)
-
- def configure(self, env):
- import params
- env.set_params(params)
-
- print "Configure."
-
- def start(self, env):
- import params
- env.set_params(params)
- self.configure(env)
-
- print "Start."
-
- def stop(self, env):
- import params
- env.set_params(params)
-
- print "Stop."
-
- def status(self, env):
- import status_params
- env.set_params(status_params)
-
- #pid_file = format("{pid_dir}/?.pid")
- #check_process_status(pid_file)
-
-# for testing
-def main():
- command_type = "install"
- command_data_file = '/root/storm.json'
- basedir = '/root/ambari/ambari-server/src/main/resources/stacks/HDP/2.0.8/services/STORM/package'
- stroutputf = '/1.txt'
- sys.argv = ["", command_type, command_data_file, basedir, stroutputf]
-
- Nimbus().execute()
-
-if __name__ == "__main__":
- Nimbus().execute()
- #main()
http://git-wip-us.apache.org/repos/asf/ambari/blob/7b8a705c/ambari-server/src/main/resources/stacks/HDP/2.0.8/services/STORM/package/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.8/services/STORM/package/params.py b/ambari-server/src/main/resources/stacks/HDP/2.0.8/services/STORM/package/params.py
deleted file mode 100644
index b722187..0000000
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.8/services/STORM/package/params.py
+++ /dev/null
@@ -1,25 +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 import *
-import status_params
-
-# server configurations
-config = Script.get_config()
http://git-wip-us.apache.org/repos/asf/ambari/blob/7b8a705c/ambari-server/src/main/resources/stacks/HDP/2.0.8/services/STORM/package/scripts/nimbus.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.8/services/STORM/package/scripts/nimbus.py b/ambari-server/src/main/resources/stacks/HDP/2.0.8/services/STORM/package/scripts/nimbus.py
new file mode 100644
index 0000000..6ed1e39
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.8/services/STORM/package/scripts/nimbus.py
@@ -0,0 +1,68 @@
+#!/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.
+
+"""
+
+import sys
+from resource_management import *
+
+
+class Nimbus(Script):
+ def install(self, env):
+ self.install_packages(env)
+ self.configure(env)
+
+ def configure(self, env):
+ import params
+ env.set_params(params)
+
+ print "Configure."
+
+ def start(self, env):
+ import params
+ env.set_params(params)
+ self.configure(env)
+
+ print "Start."
+
+ def stop(self, env):
+ import params
+ env.set_params(params)
+
+ print "Stop."
+
+ def status(self, env):
+ import status_params
+ env.set_params(status_params)
+
+ #pid_file = format("{pid_dir}/?.pid")
+ #check_process_status(pid_file)
+
+# for testing
+def main():
+ command_type = "install"
+ command_data_file = '/root/storm.json'
+ basedir = '/root/ambari/ambari-server/src/main/resources/stacks/HDP/2.0.8/services/STORM/package'
+ stroutputf = '/1.txt'
+ sys.argv = ["", command_type, command_data_file, basedir, stroutputf]
+
+ Nimbus().execute()
+
+if __name__ == "__main__":
+ Nimbus().execute()
+ #main()
http://git-wip-us.apache.org/repos/asf/ambari/blob/7b8a705c/ambari-server/src/main/resources/stacks/HDP/2.0.8/services/STORM/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.8/services/STORM/package/scripts/params.py b/ambari-server/src/main/resources/stacks/HDP/2.0.8/services/STORM/package/scripts/params.py
new file mode 100644
index 0000000..b722187
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.8/services/STORM/package/scripts/params.py
@@ -0,0 +1,25 @@
+#!/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 import *
+import status_params
+
+# server configurations
+config = Script.get_config()
http://git-wip-us.apache.org/repos/asf/ambari/blob/7b8a705c/ambari-server/src/main/resources/stacks/HDP/2.0.8/services/STORM/package/scripts/status_params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.8/services/STORM/package/scripts/status_params.py b/ambari-server/src/main/resources/stacks/HDP/2.0.8/services/STORM/package/scripts/status_params.py
new file mode 100644
index 0000000..5561e10
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.8/services/STORM/package/scripts/status_params.py
@@ -0,0 +1,19 @@
+#!/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.
+
+"""
http://git-wip-us.apache.org/repos/asf/ambari/blob/7b8a705c/ambari-server/src/main/resources/stacks/HDP/2.0.8/services/STORM/package/scripts/supervisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.8/services/STORM/package/scripts/supervisor.py b/ambari-server/src/main/resources/stacks/HDP/2.0.8/services/STORM/package/scripts/supervisor.py
new file mode 100644
index 0000000..b4ce483
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.8/services/STORM/package/scripts/supervisor.py
@@ -0,0 +1,78 @@
+#!/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.
+
+"""
+
+import sys
+from resource_management import *
+from yaml_config import yaml_config
+
+
+class Supervisor(Script):
+ def install(self, env):
+ self.install_packages(env)
+ self.configure(env)
+
+ def configure(self, env):
+ import params
+ env.set_params(params)
+
+ # example
+ #yaml_config( "storm.yaml",
+ # #conf_dir = params.conf_dir,
+ # conf_dir = "/etc/storm/conf",
+ # configurations = params.config['configurations']['storm-site'],
+ # #owner = params.storm_user,
+ # #group = params.user_group
+ #)
+
+ print "Configure."
+
+ def start(self, env):
+ import params
+ env.set_params(params)
+ self.configure(env)
+
+ print "Start."
+
+ def stop(self, env):
+ import params
+ env.set_params(params)
+
+ print "Stop."
+
+ def status(self, env):
+ import status_params
+ env.set_params(status_params)
+
+ #pid_file = format("{pid_dir}/?.pid")
+ #check_process_status(pid_file)
+
+# for testing
+def main():
+ command_type = "install"
+ command_data_file = '/root/storm.json'
+ basedir = '/root/ambari/ambari-server/src/main/resources/stacks/HDP/2.0.8/services/STORM/package'
+ stroutputf = '/1.txt'
+ sys.argv = ["", command_type, command_data_file, basedir, stroutputf]
+
+ Supervisor().execute()
+
+if __name__ == "__main__":
+ Supervisor().execute()
+ #main()
http://git-wip-us.apache.org/repos/asf/ambari/blob/7b8a705c/ambari-server/src/main/resources/stacks/HDP/2.0.8/services/STORM/package/scripts/yaml_config.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.8/services/STORM/package/scripts/yaml_config.py b/ambari-server/src/main/resources/stacks/HDP/2.0.8/services/STORM/package/scripts/yaml_config.py
new file mode 100644
index 0000000..1e91ba1
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.8/services/STORM/package/scripts/yaml_config.py
@@ -0,0 +1,19 @@
+from resource_management import *
+
+def yaml_config(
+ filename,
+ configurations = None,
+ conf_dir = None,
+ mode = None,
+ owner = None,
+ group = None
+):
+ config_content = InlineTemplate('''{% for key, value in configurations_dict.items() %}{{ key }}: {{ value }}
+{% endfor %}''', configurations_dict=configurations)
+
+ File (format("{conf_dir}/{filename}"),
+ content = config_content,
+ owner = owner,
+ group = group,
+ mode = mode
+ )
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/7b8a705c/ambari-server/src/main/resources/stacks/HDP/2.0.8/services/STORM/package/status_params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.8/services/STORM/package/status_params.py b/ambari-server/src/main/resources/stacks/HDP/2.0.8/services/STORM/package/status_params.py
deleted file mode 100644
index 5561e10..0000000
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.8/services/STORM/package/status_params.py
+++ /dev/null
@@ -1,19 +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.
-
-"""
http://git-wip-us.apache.org/repos/asf/ambari/blob/7b8a705c/ambari-server/src/main/resources/stacks/HDP/2.0.8/services/STORM/package/supervisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.8/services/STORM/package/supervisor.py b/ambari-server/src/main/resources/stacks/HDP/2.0.8/services/STORM/package/supervisor.py
deleted file mode 100644
index b4ce483..0000000
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.8/services/STORM/package/supervisor.py
+++ /dev/null
@@ -1,78 +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.
-
-"""
-
-import sys
-from resource_management import *
-from yaml_config import yaml_config
-
-
-class Supervisor(Script):
- def install(self, env):
- self.install_packages(env)
- self.configure(env)
-
- def configure(self, env):
- import params
- env.set_params(params)
-
- # example
- #yaml_config( "storm.yaml",
- # #conf_dir = params.conf_dir,
- # conf_dir = "/etc/storm/conf",
- # configurations = params.config['configurations']['storm-site'],
- # #owner = params.storm_user,
- # #group = params.user_group
- #)
-
- print "Configure."
-
- def start(self, env):
- import params
- env.set_params(params)
- self.configure(env)
-
- print "Start."
-
- def stop(self, env):
- import params
- env.set_params(params)
-
- print "Stop."
-
- def status(self, env):
- import status_params
- env.set_params(status_params)
-
- #pid_file = format("{pid_dir}/?.pid")
- #check_process_status(pid_file)
-
-# for testing
-def main():
- command_type = "install"
- command_data_file = '/root/storm.json'
- basedir = '/root/ambari/ambari-server/src/main/resources/stacks/HDP/2.0.8/services/STORM/package'
- stroutputf = '/1.txt'
- sys.argv = ["", command_type, command_data_file, basedir, stroutputf]
-
- Supervisor().execute()
-
-if __name__ == "__main__":
- Supervisor().execute()
- #main()
http://git-wip-us.apache.org/repos/asf/ambari/blob/7b8a705c/ambari-server/src/main/resources/stacks/HDP/2.0.8/services/STORM/package/yaml_config.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.8/services/STORM/package/yaml_config.py b/ambari-server/src/main/resources/stacks/HDP/2.0.8/services/STORM/package/yaml_config.py
deleted file mode 100644
index 1e91ba1..0000000
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.8/services/STORM/package/yaml_config.py
+++ /dev/null
@@ -1,19 +0,0 @@
-from resource_management import *
-
-def yaml_config(
- filename,
- configurations = None,
- conf_dir = None,
- mode = None,
- owner = None,
- group = None
-):
- config_content = InlineTemplate('''{% for key, value in configurations_dict.items() %}{{ key }}: {{ value }}
-{% endfor %}''', configurations_dict=configurations)
-
- File (format("{conf_dir}/{filename}"),
- content = config_content,
- owner = owner,
- group = group,
- mode = mode
- )
\ No newline at end of file