1
# Copyright (c) 2013 Hortonworks, Inc.
3
# Licensed under the Apache License, Version 2.0 (the "License");
4
# you may not use this file except in compliance with the License.
5
# You may obtain a copy of the License at
7
# http://www.apache.org/licenses/LICENSE-2.0
9
# Unless required by applicable law or agreed to in writing, software
10
# distributed under the License is distributed on an "AS IS" BASIS,
11
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13
# See the License for the specific language governing permissions and
14
# limitations under the License.
16
import pkg_resources as pkg
18
from sahara.plugins.hdp import clusterspec as cs
19
from sahara import version
23
def __init__(self, hostname, role, img, flavor, public_ip, private_ip):
24
self.inst_fqdn = hostname
26
self.instance_info = InstanceInfo(
27
hostname, img, flavor, public_ip, private_ip)
28
self.management_ip = public_ip
29
self.public_ip = public_ip
30
self.internal_ip = private_ip
31
self.node_group = None
40
def get_instance_info(*args, **kwargs):
41
return args[0].instance_info
44
def create_clusterspec(hdp_version='1.3.2'):
45
version_suffix = hdp_version.replace('.', '_')
46
cluster_config_file = pkg.resource_string(
47
version.version_info.package,
48
'plugins/hdp/versions/version_{0}/resources/'
49
'default-cluster.template'.format(version_suffix))
51
return cs.ClusterSpec(cluster_config_file, version=hdp_version)
55
def __init__(self, hostname, image, flavor, management_ip, internal_ip):
58
self.management_ip = management_ip
59
self.internal_ip = internal_ip
63
def __init__(self, node_groups):
64
self.hadoop_version = None
65
self.cluster_configs = {}
66
self.node_groups = node_groups
67
self.default_image_id = '11111'
71
def __init__(self, name, instances, node_processes, count=1):
73
self.instances = instances
77
self.node_processes = node_processes
80
self.ng_storage_paths = []
82
def storage_paths(self):
83
return self.ng_storage_paths
86
class TestUserInputConfig:
87
def __init__(self, tag, target, name):
89
self.applicable_target = target
94
def put(self, url, data=None, auth=None, headers=None):
98
self.headers = headers
101
return TestResult(200)
103
def post(self, url, data=None, auth=None, headers=None):
107
self.headers = headers
110
return TestResult(201)
112
def delete(self, url, auth=None, headers=None):
116
self.headers = headers
117
self.method = 'delete'
119
return TestResult(200)
123
def __init__(self, status):
124
self.status_code = status
129
def __init__(self, config, value):