AMBARI-18732. Perf: Create PERF stack with mix of HDP core services and dummy 
services (alejandro)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/fca6f1c3
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/fca6f1c3
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/fca6f1c3

Branch: refs/heads/branch-feature-AMBARI-18634
Commit: fca6f1c3a56aa13c7fda385cba5fdae59dc990ed
Parents: c9362c8
Author: Alejandro Fernandez <afernan...@hortonworks.com>
Authored: Wed Nov 2 14:52:24 2016 -0700
Committer: Alejandro Fernandez <afernan...@hortonworks.com>
Committed: Wed Nov 2 14:52:26 2016 -0700

----------------------------------------------------------------------
 .../libraries/script/dummy.py                   | 106 +++++++++++++++++++
 .../PERF/1.0/configuration/cluster-env.xml      |  75 +++++++++++++
 .../1.0/hooks/after-INSTALL/scripts/hook.py     |  28 +++++
 .../PERF/1.0/hooks/before-ANY/scripts/hook.py   |  28 +++++
 .../1.0/hooks/before-INSTALL/scripts/hook.py    |  28 +++++
 .../1.0/hooks/before-RESTART/scripts/hook.py    |  28 +++++
 .../PERF/1.0/hooks/before-START/scripts/hook.py |  28 +++++
 .../main/resources/stacks/PERF/1.0/metainfo.xml |  22 ++++
 .../PERF/1.0/properties/stack_features.json     |  14 +++
 .../stacks/PERF/1.0/properties/stack_tools.json |   4 +
 .../stacks/PERF/1.0/repos/repoinfo.xml          |  27 +++++
 .../stacks/PERF/1.0/role_command_order.json     |   8 ++
 .../services/HAPPY/configuration/happy-site.xml |  36 +++++++
 .../stacks/PERF/1.0/services/HAPPY/metainfo.xml |  57 ++++++++++
 .../1.0/services/HAPPY/package/scripts/dwarf.py |  38 +++++++
 .../HAPPY/package/scripts/service_check.py      |  30 ++++++
 .../PERF/1.0/services/HAPPY/themes/theme.json   |  65 ++++++++++++
 .../services/SNOW/configuration/snow-site.xml   |  36 +++++++
 .../stacks/PERF/1.0/services/SNOW/metainfo.xml  |  57 ++++++++++
 .../SNOW/package/scripts/service_check.py       |  30 ++++++
 .../services/SNOW/package/scripts/snow_white.py |  38 +++++++
 .../PERF/1.0/services/SNOW/themes/theme.json    |  65 ++++++++++++
 22 files changed, 848 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/fca6f1c3/ambari-common/src/main/python/resource_management/libraries/script/dummy.py
----------------------------------------------------------------------
diff --git 
a/ambari-common/src/main/python/resource_management/libraries/script/dummy.py 
b/ambari-common/src/main/python/resource_management/libraries/script/dummy.py
new file mode 100644
index 0000000..2a48de3
--- /dev/null
+++ 
b/ambari-common/src/main/python/resource_management/libraries/script/dummy.py
@@ -0,0 +1,106 @@
+"""
+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.
+
+Ambari Agent
+
+"""
+
+__all__ = ["Dummy"]
+
+# Python Imports
+import os
+
+# Local Imports
+from resource_management.libraries.script.script import Script
+from resource_management.core.resources.system import Directory, File, Execute
+from ambari_commons.constants import AMBARI_SUDO_BINARY
+from resource_management.core.exceptions import ComponentIsNotRunning
+
+
+class Dummy(Script):
+  """
+  Dummy component to be used for performance testing since doesn't actually 
run a service.
+  Reports status command based on the existence of a pid file.
+  """
+
+  # Whether or not configs have been loaded already in the prepare() method.
+  loaded = False
+
+  def prepare(self):
+    # During restart commands which executes stop + start, avoid loading 
multiple times.
+    if self.loaded:
+      return
+    self.loaded = True
+
+    self.config = Script.get_config()
+    # Cannot rely on system hostname since will run multiple Ambari agents on 
the same host.
+    self.host_name = self.config["hostname"]
+
+    # Should still define self.component_name which is needed for status 
commands.
+    if "role" in self.config:
+      self.component_name = self.config["role"]
+
+    self.pid_file = "/var/run/%s/%s.pid" % (self.host_name, 
self.component_name)
+    self.user = "root"
+    self.user_group = "root"
+    self.sudo = AMBARI_SUDO_BINARY
+
+    print "Host: %s" % self.host_name
+    print "Component: %s" % self.component_name
+    print "Pid File: %s" % self.pid_file
+
+  def install(self, env):
+    print "Install"
+    self.prepare()
+
+  def configure(self, env):
+    print "Configure"
+    self.prepare()
+
+  def start(self, env):
+    print "Start"
+    self.prepare()
+
+    if not os.path.isfile(self.pid_file):
+      print "Creating pid file: %s" % self.pid_file
+
+      Directory(os.path.dirname(self.pid_file),
+                owner=self.user,
+                group=self.user_group,
+                mode=0755,
+                create_parents=True
+                )
+
+      File(self.pid_file,
+           owner=self.user,
+           content=""
+           )
+
+  def stop(self, env):
+    print "Stop"
+    self.prepare()
+
+    if os.path.isfile(self.pid_file):
+      print "Deleting pid file: %s" % self.pid_file
+      Execute("%s rm -rf %s" % (self.sudo, self.pid_file))
+
+  def status(self, env):
+    print "Status"
+    self.prepare()
+
+    if not os.path.isfile(self.pid_file):
+      raise ComponentIsNotRunning()

http://git-wip-us.apache.org/repos/asf/ambari/blob/fca6f1c3/ambari-server/src/main/resources/stacks/PERF/1.0/configuration/cluster-env.xml
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/PERF/1.0/configuration/cluster-env.xml
 
b/ambari-server/src/main/resources/stacks/PERF/1.0/configuration/cluster-env.xml
new file mode 100644
index 0000000..a87d37e
--- /dev/null
+++ 
b/ambari-server/src/main/resources/stacks/PERF/1.0/configuration/cluster-env.xml
@@ -0,0 +1,75 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+/**
+ * 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.
+ */
+-->
+<configuration>
+
+  <!-- Define stack_tools property in the base stack. DO NOT override this 
property for each stack version -->
+  <property>
+    <name>stack_tools</name>
+    <value/>
+    <description>Stack specific tools</description>
+    <property-type>VALUE_FROM_PROPERTY_FILE</property-type>
+    <value-attributes>
+      <property-file-name>stack_tools.json</property-file-name>
+      <property-file-type>json</property-file-type>
+      <read-only>true</read-only>
+      <overridable>false</overridable>
+      <visible>false</visible>
+    </value-attributes>
+    <on-ambari-upgrade add="true"/>
+  </property>
+
+  <!-- Define stack_features property in the base stack. DO NOT override this 
property for each stack version -->
+  <property>
+    <name>stack_features</name>
+    <value/>
+    <description>List of features supported by the stack</description>
+    <property-type>VALUE_FROM_PROPERTY_FILE</property-type>
+    <value-attributes>
+      <property-file-name>stack_features.json</property-file-name>
+      <property-file-type>json</property-file-type>
+      <read-only>true</read-only>
+      <overridable>false</overridable>
+      <visible>false</visible>
+    </value-attributes>
+    <on-ambari-upgrade add="true"/>
+  </property>
+
+  <property>
+    <name>stack_root</name>
+    <value>/usr/perf</value>
+    <description>Stack root folder</description>
+    <value-attributes>
+      <read-only>true</read-only>
+      <overridable>false</overridable>
+      <visible>false</visible>
+    </value-attributes>
+    <on-ambari-upgrade add="true"/>
+  </property>
+
+  <property>
+    <name>security_enabled</name>
+    <value>false</value>
+    <description>Security</description>
+    <on-ambari-upgrade add="true"/>
+  </property>
+
+</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/fca6f1c3/ambari-server/src/main/resources/stacks/PERF/1.0/hooks/after-INSTALL/scripts/hook.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/PERF/1.0/hooks/after-INSTALL/scripts/hook.py
 
b/ambari-server/src/main/resources/stacks/PERF/1.0/hooks/after-INSTALL/scripts/hook.py
new file mode 100644
index 0000000..7f6e819
--- /dev/null
+++ 
b/ambari-server/src/main/resources/stacks/PERF/1.0/hooks/after-INSTALL/scripts/hook.py
@@ -0,0 +1,28 @@
+"""
+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.script import Hook
+
+class AfterInstallHook(Hook):
+
+  def hook(self, env):
+    print "After Install Hook"
+
+if __name__ == "__main__":
+  AfterInstallHook().execute()

http://git-wip-us.apache.org/repos/asf/ambari/blob/fca6f1c3/ambari-server/src/main/resources/stacks/PERF/1.0/hooks/before-ANY/scripts/hook.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/PERF/1.0/hooks/before-ANY/scripts/hook.py
 
b/ambari-server/src/main/resources/stacks/PERF/1.0/hooks/before-ANY/scripts/hook.py
new file mode 100644
index 0000000..90e0266
--- /dev/null
+++ 
b/ambari-server/src/main/resources/stacks/PERF/1.0/hooks/before-ANY/scripts/hook.py
@@ -0,0 +1,28 @@
+"""
+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.script import Hook
+
+class BeforeAnyHook(Hook):
+
+  def hook(self, env):
+    print "Before Any Hook"
+
+if __name__ == "__main__":
+  BeforeAnyHook().execute()

http://git-wip-us.apache.org/repos/asf/ambari/blob/fca6f1c3/ambari-server/src/main/resources/stacks/PERF/1.0/hooks/before-INSTALL/scripts/hook.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/PERF/1.0/hooks/before-INSTALL/scripts/hook.py
 
b/ambari-server/src/main/resources/stacks/PERF/1.0/hooks/before-INSTALL/scripts/hook.py
new file mode 100644
index 0000000..9eca9ec
--- /dev/null
+++ 
b/ambari-server/src/main/resources/stacks/PERF/1.0/hooks/before-INSTALL/scripts/hook.py
@@ -0,0 +1,28 @@
+"""
+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.script import Hook
+
+class BeforeInstallHook(Hook):
+
+  def hook(self, env):
+    print "Before Install Hook"
+
+if __name__ == "__main__":
+  BeforeInstallHook().execute()

http://git-wip-us.apache.org/repos/asf/ambari/blob/fca6f1c3/ambari-server/src/main/resources/stacks/PERF/1.0/hooks/before-RESTART/scripts/hook.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/PERF/1.0/hooks/before-RESTART/scripts/hook.py
 
b/ambari-server/src/main/resources/stacks/PERF/1.0/hooks/before-RESTART/scripts/hook.py
new file mode 100644
index 0000000..a366129
--- /dev/null
+++ 
b/ambari-server/src/main/resources/stacks/PERF/1.0/hooks/before-RESTART/scripts/hook.py
@@ -0,0 +1,28 @@
+"""
+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.script import Hook
+
+class BeforeRestartHook(Hook):
+
+  def hook(self, env):
+    print "Before Restart Hook"
+
+if __name__ == "__main__":
+  BeforeRestartHook().execute()

http://git-wip-us.apache.org/repos/asf/ambari/blob/fca6f1c3/ambari-server/src/main/resources/stacks/PERF/1.0/hooks/before-START/scripts/hook.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/PERF/1.0/hooks/before-START/scripts/hook.py
 
b/ambari-server/src/main/resources/stacks/PERF/1.0/hooks/before-START/scripts/hook.py
new file mode 100644
index 0000000..c5600a3
--- /dev/null
+++ 
b/ambari-server/src/main/resources/stacks/PERF/1.0/hooks/before-START/scripts/hook.py
@@ -0,0 +1,28 @@
+"""
+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.script import Hook
+
+class BeforeStartHook(Hook):
+
+  def hook(self, env):
+    print "Before Start Hook"
+
+if __name__ == "__main__":
+  BeforeStartHook().execute()

http://git-wip-us.apache.org/repos/asf/ambari/blob/fca6f1c3/ambari-server/src/main/resources/stacks/PERF/1.0/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/PERF/1.0/metainfo.xml 
b/ambari-server/src/main/resources/stacks/PERF/1.0/metainfo.xml
new file mode 100644
index 0000000..45a63e5
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/PERF/1.0/metainfo.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+<!--
+   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.
+-->
+<metainfo>
+    <versions>
+         <active>false</active>
+    </versions>
+</metainfo>

http://git-wip-us.apache.org/repos/asf/ambari/blob/fca6f1c3/ambari-server/src/main/resources/stacks/PERF/1.0/properties/stack_features.json
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/PERF/1.0/properties/stack_features.json
 
b/ambari-server/src/main/resources/stacks/PERF/1.0/properties/stack_features.json
new file mode 100644
index 0000000..81640b6
--- /dev/null
+++ 
b/ambari-server/src/main/resources/stacks/PERF/1.0/properties/stack_features.json
@@ -0,0 +1,14 @@
+{
+  "stack_features": [
+    {
+      "name": "rolling_upgrade",
+      "description": "Rolling upgrade support",
+      "min_version": "1.0.0.0"
+    },
+    {
+      "name": "config_versioning",
+      "description": "Configurable versions support",
+      "min_version": "1.0.0.0"
+    }
+  ]
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/fca6f1c3/ambari-server/src/main/resources/stacks/PERF/1.0/properties/stack_tools.json
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/PERF/1.0/properties/stack_tools.json 
b/ambari-server/src/main/resources/stacks/PERF/1.0/properties/stack_tools.json
new file mode 100644
index 0000000..535b9d9
--- /dev/null
+++ 
b/ambari-server/src/main/resources/stacks/PERF/1.0/properties/stack_tools.json
@@ -0,0 +1,4 @@
+{
+  "stack_selector": ["distro-select", "/usr/bin/distro-select", 
"distro-select"],
+  "conf_selector": ["conf-select", "/usr/bin/conf-select", "conf-select"]
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/fca6f1c3/ambari-server/src/main/resources/stacks/PERF/1.0/repos/repoinfo.xml
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/PERF/1.0/repos/repoinfo.xml 
b/ambari-server/src/main/resources/stacks/PERF/1.0/repos/repoinfo.xml
new file mode 100644
index 0000000..c5137fb
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/PERF/1.0/repos/repoinfo.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<!--
+   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.
+-->
+<reposinfo>
+  <os family="redhat6">
+    <repo>
+      <baseurl>http://foo</baseurl>
+      <repoid>PERF-1.0</repoid>
+      <reponame>PERF</reponame>
+      <unique>true</unique>
+    </repo>
+  </os>
+</reposinfo>

http://git-wip-us.apache.org/repos/asf/ambari/blob/fca6f1c3/ambari-server/src/main/resources/stacks/PERF/1.0/role_command_order.json
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/PERF/1.0/role_command_order.json 
b/ambari-server/src/main/resources/stacks/PERF/1.0/role_command_order.json
new file mode 100644
index 0000000..701b567
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/PERF/1.0/role_command_order.json
@@ -0,0 +1,8 @@
+{
+  "_comment" : "Record format:",
+  "_comment" : "blockedRole-blockedCommand: [blockerRole1-blockerCommand1, 
blockerRole2-blockerCommand2, ...]",
+  "general_deps" : {
+    "_comment" : "dependencies for all cases",
+    "HAPPY-START": ["SNOW-START"]
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/fca6f1c3/ambari-server/src/main/resources/stacks/PERF/1.0/services/HAPPY/configuration/happy-site.xml
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/PERF/1.0/services/HAPPY/configuration/happy-site.xml
 
b/ambari-server/src/main/resources/stacks/PERF/1.0/services/HAPPY/configuration/happy-site.xml
new file mode 100644
index 0000000..7d521b8
--- /dev/null
+++ 
b/ambari-server/src/main/resources/stacks/PERF/1.0/services/HAPPY/configuration/happy-site.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+/**
+ * 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.
+ */
+-->
+<configuration>
+  <property>
+    <name>success.percentage</name>
+    <value>100</value>
+    <description>The success percentage of any operation.</description>
+    <display-name>Success percentage</display-name>
+    <value-attributes>
+      <type>int</type>
+      <minimum>0</minimum>
+      <maximum>100</maximum>
+      <increment-step>10</increment-step>
+    </value-attributes>
+    <on-ambari-upgrade add="true"/>
+  </property>
+</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/fca6f1c3/ambari-server/src/main/resources/stacks/PERF/1.0/services/HAPPY/metainfo.xml
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/PERF/1.0/services/HAPPY/metainfo.xml 
b/ambari-server/src/main/resources/stacks/PERF/1.0/services/HAPPY/metainfo.xml
new file mode 100644
index 0000000..36a2168
--- /dev/null
+++ 
b/ambari-server/src/main/resources/stacks/PERF/1.0/services/HAPPY/metainfo.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0"?>
+<!--
+   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.
+-->
+<metainfo>
+  <schemaVersion>2.0</schemaVersion>
+  <services>
+    <service>
+      <name>HAPPY</name>
+      <displayName>Happy</displayName>
+      <comment>Always passes</comment>
+      <version>1.0</version>
+      <components>
+
+        <component>
+          <name>HAPPY</name>
+          <displayName>Happy</displayName>
+          <category>SLAVE</category>
+          <cardinality>0+</cardinality>
+          <commandScript>
+            <script>scripts/dwarf.py</script>
+            <scriptType>PYTHON</scriptType>
+            <timeout>600</timeout>
+          </commandScript>
+        </component>
+      </components>
+
+      <commandScript>
+        <script>scripts/service_check.py</script>
+        <scriptType>PYTHON</scriptType>
+        <timeout>300</timeout>
+      </commandScript>
+
+      <restartRequiredAfterChange>true</restartRequiredAfterChange>
+
+      <themes>
+        <theme>
+          <fileName>theme.json</fileName>
+          <default>true</default>
+        </theme>
+      </themes>
+    </service>
+  </services>
+</metainfo>

http://git-wip-us.apache.org/repos/asf/ambari/blob/fca6f1c3/ambari-server/src/main/resources/stacks/PERF/1.0/services/HAPPY/package/scripts/dwarf.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/PERF/1.0/services/HAPPY/package/scripts/dwarf.py
 
b/ambari-server/src/main/resources/stacks/PERF/1.0/services/HAPPY/package/scripts/dwarf.py
new file mode 100644
index 0000000..b86c4c7
--- /dev/null
+++ 
b/ambari-server/src/main/resources/stacks/PERF/1.0/services/HAPPY/package/scripts/dwarf.py
@@ -0,0 +1,38 @@
+"""
+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.
+
+Ambari Agent
+
+"""
+
+# Python Imports
+
+# Local Imports
+from resource_management.libraries.script.dummy import Dummy
+
+
+class Happy(Dummy):
+  """
+  Dummy script that simulates a slave component.
+  """
+
+  def __init__(self):
+    super(Happy, self).__init__()
+    self.component_name = "HAPPY"
+
+if __name__ == "__main__":
+  Happy().execute()

http://git-wip-us.apache.org/repos/asf/ambari/blob/fca6f1c3/ambari-server/src/main/resources/stacks/PERF/1.0/services/HAPPY/package/scripts/service_check.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/PERF/1.0/services/HAPPY/package/scripts/service_check.py
 
b/ambari-server/src/main/resources/stacks/PERF/1.0/services/HAPPY/package/scripts/service_check.py
new file mode 100644
index 0000000..270b082
--- /dev/null
+++ 
b/ambari-server/src/main/resources/stacks/PERF/1.0/services/HAPPY/package/scripts/service_check.py
@@ -0,0 +1,30 @@
+"""
+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.
+
+Ambari Agent
+
+"""
+
+from resource_management.libraries.script.script import Script
+
+class ServiceCheck(Script):
+
+  def service_check(self, env):
+    print "Service Check"
+
+if __name__ == "__main__":
+  ServiceCheck().execute()

http://git-wip-us.apache.org/repos/asf/ambari/blob/fca6f1c3/ambari-server/src/main/resources/stacks/PERF/1.0/services/HAPPY/themes/theme.json
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/PERF/1.0/services/HAPPY/themes/theme.json
 
b/ambari-server/src/main/resources/stacks/PERF/1.0/services/HAPPY/themes/theme.json
new file mode 100644
index 0000000..46ac265
--- /dev/null
+++ 
b/ambari-server/src/main/resources/stacks/PERF/1.0/services/HAPPY/themes/theme.json
@@ -0,0 +1,65 @@
+{
+  "name": "default",
+  "description": "Default theme",
+  "configuration": {
+    "layouts": [
+      {
+        "name": "default",
+        "tabs": [
+          {
+            "name": "settings",
+            "display-name": "Settings",
+            "layout": {
+              "tab-columns": "1",
+              "tab-rows": "1",
+              "sections": [
+                {
+                  "name": "section-general",
+                  "display-name": "General",
+                  "row-index": "0",
+                  "column-index": "0",
+                  "row-span": "1",
+                  "column-span": "1",
+                  "section-columns": "1",
+                  "section-rows": "1",
+                  "subsections": [
+                    {
+                      "name": "subsection-general",
+                      "display-name": "Features",
+                      "row-index": "0",
+                      "column-index": "0",
+                      "row-span": "1",
+                      "column-span": "1"
+                    }
+                  ]
+                }
+              ]
+            }
+          }
+        ]
+      }
+    ],
+    "placement": {
+      "configuration-layout": "default",
+      "configs": [
+        {
+          "config": "happy-site/success.percentage",
+          "subsection-name": "subsection-general"
+        }
+      ]
+    },
+    "widgets": [
+      {
+        "config": "happy-site/success.percentage",
+        "widget": {
+          "type": "slider",
+          "units": [
+            {
+              "unit-name": "percent"
+            }
+          ]
+        }
+      }
+    ]
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/fca6f1c3/ambari-server/src/main/resources/stacks/PERF/1.0/services/SNOW/configuration/snow-site.xml
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/PERF/1.0/services/SNOW/configuration/snow-site.xml
 
b/ambari-server/src/main/resources/stacks/PERF/1.0/services/SNOW/configuration/snow-site.xml
new file mode 100644
index 0000000..7d521b8
--- /dev/null
+++ 
b/ambari-server/src/main/resources/stacks/PERF/1.0/services/SNOW/configuration/snow-site.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+/**
+ * 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.
+ */
+-->
+<configuration>
+  <property>
+    <name>success.percentage</name>
+    <value>100</value>
+    <description>The success percentage of any operation.</description>
+    <display-name>Success percentage</display-name>
+    <value-attributes>
+      <type>int</type>
+      <minimum>0</minimum>
+      <maximum>100</maximum>
+      <increment-step>10</increment-step>
+    </value-attributes>
+    <on-ambari-upgrade add="true"/>
+  </property>
+</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/fca6f1c3/ambari-server/src/main/resources/stacks/PERF/1.0/services/SNOW/metainfo.xml
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/PERF/1.0/services/SNOW/metainfo.xml 
b/ambari-server/src/main/resources/stacks/PERF/1.0/services/SNOW/metainfo.xml
new file mode 100644
index 0000000..cbb57f6
--- /dev/null
+++ 
b/ambari-server/src/main/resources/stacks/PERF/1.0/services/SNOW/metainfo.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0"?>
+<!--
+   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.
+-->
+<metainfo>
+  <schemaVersion>2.0</schemaVersion>
+  <services>
+    <service>
+      <name>SNOW</name>
+      <displayName>Snow</displayName>
+      <comment>Always passes</comment>
+      <version>1.0</version>
+      <components>
+
+        <component>
+          <name>SNOW_WHITE</name>
+          <displayName>Snow White</displayName>
+          <category>MASTER</category>
+          <cardinality>1</cardinality>
+          <commandScript>
+            <script>scripts/snow_white.py</script>
+            <scriptType>PYTHON</scriptType>
+            <timeout>600</timeout>
+          </commandScript>
+        </component>
+      </components>
+
+      <commandScript>
+        <script>scripts/service_check.py</script>
+        <scriptType>PYTHON</scriptType>
+        <timeout>300</timeout>
+      </commandScript>
+
+      <restartRequiredAfterChange>true</restartRequiredAfterChange>
+
+      <themes>
+        <theme>
+          <fileName>theme.json</fileName>
+          <default>true</default>
+        </theme>
+      </themes>
+    </service>
+  </services>
+</metainfo>

http://git-wip-us.apache.org/repos/asf/ambari/blob/fca6f1c3/ambari-server/src/main/resources/stacks/PERF/1.0/services/SNOW/package/scripts/service_check.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/PERF/1.0/services/SNOW/package/scripts/service_check.py
 
b/ambari-server/src/main/resources/stacks/PERF/1.0/services/SNOW/package/scripts/service_check.py
new file mode 100644
index 0000000..270b082
--- /dev/null
+++ 
b/ambari-server/src/main/resources/stacks/PERF/1.0/services/SNOW/package/scripts/service_check.py
@@ -0,0 +1,30 @@
+"""
+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.
+
+Ambari Agent
+
+"""
+
+from resource_management.libraries.script.script import Script
+
+class ServiceCheck(Script):
+
+  def service_check(self, env):
+    print "Service Check"
+
+if __name__ == "__main__":
+  ServiceCheck().execute()

http://git-wip-us.apache.org/repos/asf/ambari/blob/fca6f1c3/ambari-server/src/main/resources/stacks/PERF/1.0/services/SNOW/package/scripts/snow_white.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/PERF/1.0/services/SNOW/package/scripts/snow_white.py
 
b/ambari-server/src/main/resources/stacks/PERF/1.0/services/SNOW/package/scripts/snow_white.py
new file mode 100644
index 0000000..41bfa8a
--- /dev/null
+++ 
b/ambari-server/src/main/resources/stacks/PERF/1.0/services/SNOW/package/scripts/snow_white.py
@@ -0,0 +1,38 @@
+"""
+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.
+
+Ambari Agent
+
+"""
+
+# Python Imports
+
+# Local Imports
+from resource_management.libraries.script.dummy import Dummy
+
+
+class SnowWhite(Dummy):
+  """
+  Dummy script that simulates a master component.
+  """
+
+  def __init__(self):
+    super(SnowWhite, self).__init__()
+    self.component_name = "SNOW_WHITE"
+
+if __name__ == "__main__":
+  SnowWhite().execute()

http://git-wip-us.apache.org/repos/asf/ambari/blob/fca6f1c3/ambari-server/src/main/resources/stacks/PERF/1.0/services/SNOW/themes/theme.json
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/PERF/1.0/services/SNOW/themes/theme.json
 
b/ambari-server/src/main/resources/stacks/PERF/1.0/services/SNOW/themes/theme.json
new file mode 100644
index 0000000..31eb11f
--- /dev/null
+++ 
b/ambari-server/src/main/resources/stacks/PERF/1.0/services/SNOW/themes/theme.json
@@ -0,0 +1,65 @@
+{
+  "name": "default",
+  "description": "Default theme",
+  "configuration": {
+    "layouts": [
+      {
+        "name": "default",
+        "tabs": [
+          {
+            "name": "settings",
+            "display-name": "Settings",
+            "layout": {
+              "tab-columns": "1",
+              "tab-rows": "1",
+              "sections": [
+                {
+                  "name": "section-general",
+                  "display-name": "General",
+                  "row-index": "0",
+                  "column-index": "0",
+                  "row-span": "1",
+                  "column-span": "1",
+                  "section-columns": "1",
+                  "section-rows": "1",
+                  "subsections": [
+                    {
+                      "name": "subsection-general",
+                      "display-name": "Features",
+                      "row-index": "0",
+                      "column-index": "0",
+                      "row-span": "1",
+                      "column-span": "1"
+                    }
+                  ]
+                }
+              ]
+            }
+          }
+        ]
+      }
+    ],
+    "placement": {
+      "configuration-layout": "default",
+      "configs": [
+        {
+          "config": "snow-site/success.percentage",
+          "subsection-name": "subsection-general"
+        }
+      ]
+    },
+    "widgets": [
+      {
+        "config": "snow-site/success.percentage",
+        "widget": {
+          "type": "slider",
+          "units": [
+            {
+              "unit-name": "percent"
+            }
+          ]
+        }
+      }
+    ]
+  }
+}

Reply via email to