From 843ffcfa7d624fd4dd114e70d21f7f965ae1bd54 Mon Sep 17 00:00:00 2001 From: Sergey Lukjanov Date: Thu, 24 Apr 2014 14:31:00 +0400 Subject: [PATCH] Add simple fake plugin for testing We need to have fake plugin to perform provisioning testing in gate. Partially Implements: blueprint fake-test-plugin Change-Id: I112ca08462f3a0a9847e16deba6d8535182a28d6 --- sahara/plugins/fake/__init__.py | 0 sahara/plugins/fake/plugin.py | 48 +++++++++++++++++++++++++++++++++ setup.cfg | 1 + 3 files changed, 49 insertions(+) create mode 100644 sahara/plugins/fake/__init__.py create mode 100644 sahara/plugins/fake/plugin.py diff --git a/sahara/plugins/fake/__init__.py b/sahara/plugins/fake/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/sahara/plugins/fake/plugin.py b/sahara/plugins/fake/plugin.py new file mode 100644 index 00000000..65f9519d --- /dev/null +++ b/sahara/plugins/fake/plugin.py @@ -0,0 +1,48 @@ +# Copyright (c) 2014 Mirantis Inc. +# +# Licensed 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 sahara.plugins import provisioning as p + + +class FakePluginProvider(p.ProvisioningPluginBase): + + def get_title(self): + return "Fake Plugin" + + def get_description(self): + return ("It's a fake plugin that aimed to work on the CirrOS images. " + "It doesn't install Hadoop. It's needed to be able to test " + "provisioning part of Sahara codebase itself.") + + def get_versions(self): + return ["0.1"] + + def get_node_processes(self, hadoop_version): + return { + "HDFS": ["namenode", "datanode"], + "MapReduce": ["tasktracker", "jobtracker"], + } + + def get_configs(self, hadoop_version): + # no need to expose any configs, it could be checked using real plugins + return [] + + def configure_cluster(self, cluster): + # noop + pass + + def start_cluster(self, cluster): + # noop + pass diff --git a/setup.cfg b/setup.cfg index 4c6b111d..5dc9cadd 100644 --- a/setup.cfg +++ b/setup.cfg @@ -36,6 +36,7 @@ console_scripts = sahara.cluster.plugins = vanilla = sahara.plugins.vanilla.plugin:VanillaProvider hdp = sahara.plugins.hdp.ambariplugin:AmbariPlugin + fake = sahara.plugins.fake.plugin:FakePluginProvider sahara.infrastructure.engine = direct = sahara.service.direct_engine:DirectEngine