Renaming internal variables away from savanna

*Renaming internal variables from savanna to sahara where appropriate.
*Other savanna instances are renamed to something more generic

Partial-Implements:  blueprint savanna-renaming-dashboard

Change-Id: Idc843e5c7ed0d42443c49842818f82751bfc7095
This commit is contained in:
Chad Roberts 2014-03-13 12:13:47 -04:00
parent 7be61a0331
commit 35c82af8be
43 changed files with 234 additions and 234 deletions

View File

@ -17,9 +17,9 @@ from saharadashboard.utils import workflow_helpers as work_helpers
class Helpers(object): class Helpers(object):
def __init__(self, savanna_client): def __init__(self, sahara_client):
self.savanna = savanna_client self.sahara = sahara_client
self.plugins = self.savanna.plugins self.plugins = self.sahara.plugins
def _get_node_processes(self, plugin): def _get_node_processes(self, plugin):
processes = [] processes = []

View File

@ -17,7 +17,7 @@ from django.utils.translation import ugettext_lazy as _
from horizon import forms from horizon import forms
from horizon import messages from horizon import messages
from saharadashboard.api import client as savannaclient from saharadashboard.api import client as saharaclient
from saharadashboard.utils import workflow_helpers from saharadashboard.utils import workflow_helpers
from savannaclient.api import base as api_base from savannaclient.api import base as api_base
@ -30,8 +30,8 @@ class UploadFileForm(forms.SelfHandlingForm,
def __init__(self, request, *args, **kwargs): def __init__(self, request, *args, **kwargs):
super(UploadFileForm, self).__init__(request, *args, **kwargs) super(UploadFileForm, self).__init__(request, *args, **kwargs)
savanna = savannaclient.client(request) sahara = saharaclient.client(request)
self._generate_plugin_version_fields(savanna) self._generate_plugin_version_fields(sahara)
self.fields['template_file'] = forms.FileField(label=_("Template"), self.fields['template_file'] = forms.FileField(label=_("Template"),
required=True) required=True)
@ -44,11 +44,11 @@ class UploadFileForm(forms.SelfHandlingForm,
plugin_name = data['plugin_name'] plugin_name = data['plugin_name']
hadoop_version = data.get(plugin_name + "_version") hadoop_version = data.get(plugin_name + "_version")
savanna = savannaclient.client(request) sahara = saharaclient.client(request)
savanna.plugins.convert_to_cluster_template(plugin_name, sahara.plugins.convert_to_cluster_template(plugin_name,
hadoop_version, hadoop_version,
data['template_name'], data['template_name'],
filecontent) filecontent)
return True return True
except api_base.APIException as e: except api_base.APIException as e:
messages.error(request, str(e)) messages.error(request, str(e))

View File

@ -22,7 +22,7 @@ from django.utils.translation import ugettext_lazy as _
from horizon import tables from horizon import tables
from saharadashboard.api.client import client as savannaclient from saharadashboard.api.client import client as saharaclient
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -76,8 +76,8 @@ class DeleteTemplate(tables.BatchAction):
return True return True
def action(self, request, template_id): def action(self, request, template_id):
savanna = savannaclient(request) sahara = saharaclient(request)
savanna.cluster_templates.delete(template_id) sahara.cluster_templates.delete(template_id)
class CreateClusterTemplate(tables.LinkAction): class CreateClusterTemplate(tables.LinkAction):

View File

@ -19,7 +19,7 @@ from django.utils.translation import ugettext_lazy as _
from horizon import tabs from horizon import tabs
from saharadashboard.api.client import client as savannaclient from saharadashboard.api.client import client as saharaclient
from saharadashboard.utils import importutils from saharadashboard.utils import importutils
from saharadashboard.utils import workflow_helpers as helpers from saharadashboard.utils import workflow_helpers as helpers
nova = importutils.import_any('openstack_dashboard.api.nova', nova = importutils.import_any('openstack_dashboard.api.nova',
@ -35,8 +35,8 @@ class GeneralTab(tabs.Tab):
def get_context_data(self, request): def get_context_data(self, request):
template_id = self.tab_group.kwargs['template_id'] template_id = self.tab_group.kwargs['template_id']
savanna = savannaclient(request) sahara = saharaclient(request)
template = savanna.cluster_templates.get(template_id) template = sahara.cluster_templates.get(template_id)
return {"template": template} return {"template": template}
@ -47,14 +47,14 @@ class NodeGroupsTab(tabs.Tab):
def get_context_data(self, request): def get_context_data(self, request):
template_id = self.tab_group.kwargs['template_id'] template_id = self.tab_group.kwargs['template_id']
savanna = savannaclient(request) sahara = saharaclient(request)
template = savanna.cluster_templates.get(template_id) template = sahara.cluster_templates.get(template_id)
for ng in template.node_groups: for ng in template.node_groups:
if not ng["flavor_id"]: if not ng["flavor_id"]:
continue continue
ng["flavor_name"] = nova.flavor_get(request, ng["flavor_id"]).name ng["flavor_name"] = nova.flavor_get(request, ng["flavor_id"]).name
ng["node_group_template"] = helpers.safe_call( ng["node_group_template"] = helpers.safe_call(
savanna.node_group_templates.get, sahara.node_group_templates.get,
ng.get("node_group_template_id", None)) ng.get("node_group_template_id", None))
return {"template": template} return {"template": template}

View File

@ -21,7 +21,7 @@ from horizon import tables
from horizon import tabs from horizon import tabs
from horizon import workflows from horizon import workflows
from saharadashboard.api.client import client as savannaclient from saharadashboard.api.client import client as saharaclient
from saharadashboard.cluster_templates import forms as cluster_forms from saharadashboard.cluster_templates import forms as cluster_forms
from saharadashboard.cluster_templates.tables import ClusterTemplatesTable from saharadashboard.cluster_templates.tables import ClusterTemplatesTable
import saharadashboard.cluster_templates.tabs as _tabs import saharadashboard.cluster_templates.tabs as _tabs
@ -36,8 +36,8 @@ class ClusterTemplatesView(tables.DataTableView):
template_name = 'cluster_templates/cluster_templates.html' template_name = 'cluster_templates/cluster_templates.html'
def get_data(self): def get_data(self):
savanna = savannaclient(self.request) sahara = saharaclient(self.request)
cluster_templates = savanna.cluster_templates.list() cluster_templates = sahara.cluster_templates.list()
return cluster_templates return cluster_templates
@ -89,8 +89,8 @@ class CopyClusterTemplateView(workflows.WorkflowView):
def get_object(self, *args, **kwargs): def get_object(self, *args, **kwargs):
if not hasattr(self, "_object"): if not hasattr(self, "_object"):
template_id = self.kwargs['template_id'] template_id = self.kwargs['template_id']
savanna = savannaclient(self.request) sahara = saharaclient(self.request)
template = savanna.cluster_templates.get(template_id) template = sahara.cluster_templates.get(template_id)
self._object = template self._object = template
return self._object return self._object

View File

@ -17,7 +17,7 @@ import logging
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from saharadashboard.api.client import client as savannaclient from saharadashboard.api.client import client as saharaclient
import saharadashboard.cluster_templates.workflows.create as create_flow import saharadashboard.cluster_templates.workflows.create as create_flow
from saharadashboard.utils.workflow_helpers import build_node_group_fields from saharadashboard.utils.workflow_helpers import build_node_group_fields
@ -28,10 +28,10 @@ class CopyClusterTemplate(create_flow.ConfigureClusterTemplate):
success_message = _("Cluster Template copy %s created") success_message = _("Cluster Template copy %s created")
def __init__(self, request, context_seed, entry_point, *args, **kwargs): def __init__(self, request, context_seed, entry_point, *args, **kwargs):
savanna = savannaclient(request) sahara = saharaclient(request)
template_id = context_seed["template_id"] template_id = context_seed["template_id"]
template = savanna.cluster_templates.get(template_id) template = sahara.cluster_templates.get(template_id)
self._set_configs_to_copy(template.cluster_configs) self._set_configs_to_copy(template.cluster_configs)
request.GET = request.GET.copy() request.GET = request.GET.copy()

View File

@ -22,7 +22,7 @@ from horizon import exceptions
from horizon import forms from horizon import forms
from horizon import workflows from horizon import workflows
from saharadashboard.api import client as savannaclient from saharadashboard.api import client as saharaclient
from saharadashboard.api import helpers as helpers from saharadashboard.api import helpers as helpers
from saharadashboard.utils import anti_affinity as aa from saharadashboard.utils import anti_affinity as aa
import saharadashboard.utils.workflow_helpers as whelpers import saharadashboard.utils.workflow_helpers as whelpers
@ -39,8 +39,8 @@ class SelectPluginAction(workflows.Action):
def __init__(self, request, *args, **kwargs): def __init__(self, request, *args, **kwargs):
super(SelectPluginAction, self).__init__(request, *args, **kwargs) super(SelectPluginAction, self).__init__(request, *args, **kwargs)
savanna = savannaclient.client(request) sahara = saharaclient.client(request)
plugins = savanna.plugins.list() plugins = sahara.plugins.list()
plugin_choices = [(plugin.name, plugin.title) for plugin in plugins] plugin_choices = [(plugin.name, plugin.title) for plugin in plugins]
self.fields["plugin_name"] = forms.ChoiceField( self.fields["plugin_name"] = forms.ChoiceField(
@ -162,12 +162,12 @@ class ConfigureNodegroupsAction(workflows.Action):
super(ConfigureNodegroupsAction, self). \ super(ConfigureNodegroupsAction, self). \
__init__(request, *args, **kwargs) __init__(request, *args, **kwargs)
savanna = savannaclient.client(request) sahara = saharaclient.client(request)
plugin, hadoop_version = whelpers.\ plugin, hadoop_version = whelpers.\
get_plugin_and_hadoop_version(request) get_plugin_and_hadoop_version(request)
self.templates = savanna.node_group_templates.find( self.templates = sahara.node_group_templates.find(
plugin_name=plugin, plugin_name=plugin,
hadoop_version=hadoop_version) hadoop_version=hadoop_version)
@ -227,8 +227,8 @@ class ConfigureClusterTemplate(whelpers.ServiceParametersWorkflow,
def __init__(self, request, context_seed, entry_point, *args, **kwargs): def __init__(self, request, context_seed, entry_point, *args, **kwargs):
ConfigureClusterTemplate._cls_registry = set([]) ConfigureClusterTemplate._cls_registry = set([])
savanna = savannaclient.client(request) sahara = saharaclient.client(request)
hlps = helpers.Helpers(savanna) hlps = helpers.Helpers(sahara)
plugin, hadoop_version = whelpers.\ plugin, hadoop_version = whelpers.\
get_plugin_and_hadoop_version(request) get_plugin_and_hadoop_version(request)
@ -263,7 +263,7 @@ class ConfigureClusterTemplate(whelpers.ServiceParametersWorkflow,
def handle(self, request, context): def handle(self, request, context):
try: try:
savanna = savannaclient.client(request) sahara = saharaclient.client(request)
node_groups = [] node_groups = []
configs_dict = whelpers.parse_configs_from_context(context, configs_dict = whelpers.parse_configs_from_context(context,
self.defaults) self.defaults)
@ -283,7 +283,7 @@ class ConfigureClusterTemplate(whelpers.ServiceParametersWorkflow,
get_plugin_and_hadoop_version(request) get_plugin_and_hadoop_version(request)
#TODO(nkonovalov): Fix client to support default_image_id #TODO(nkonovalov): Fix client to support default_image_id
savanna.cluster_templates.create( sahara.cluster_templates.create(
context["general_cluster_template_name"], context["general_cluster_template_name"],
plugin, plugin,
hadoop_version, hadoop_version,

View File

@ -18,7 +18,7 @@ import logging
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from horizon import tables from horizon import tables
from saharadashboard.api.client import client as savannaclient from saharadashboard.api.client import client as saharaclient
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -50,16 +50,16 @@ class DeleteCluster(tables.BatchAction):
classes = ('btn-danger', 'btn-terminate') classes = ('btn-danger', 'btn-terminate')
def action(self, request, obj_id): def action(self, request, obj_id):
savanna = savannaclient(request) sahara = saharaclient(request)
savanna.clusters.delete(obj_id) sahara.clusters.delete(obj_id)
class UpdateRow(tables.Row): class UpdateRow(tables.Row):
ajax = True ajax = True
def get_data(self, request, instance_id): def get_data(self, request, instance_id):
savanna = savannaclient(request) sahara = saharaclient(request)
instance = savanna.clusters.get(instance_id) instance = sahara.clusters.get(instance_id)
return instance return instance

View File

@ -33,7 +33,7 @@ glance = importutils.import_any('openstack_dashboard.api.glance',
'horizon.api.glance') 'horizon.api.glance')
from saharadashboard.api.client import client as savannaclient from saharadashboard.api.client import client as saharaclient
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -45,8 +45,8 @@ class GeneralTab(tabs.Tab):
def get_context_data(self, request): def get_context_data(self, request):
cluster_id = self.tab_group.kwargs['cluster_id'] cluster_id = self.tab_group.kwargs['cluster_id']
savanna = savannaclient(request) sahara = saharaclient(request)
cluster = savanna.clusters.get(cluster_id) cluster = sahara.clusters.get(cluster_id)
for info_key, info_val in cluster.info.items(): for info_key, info_val in cluster.info.items():
for key, val in info_val.items(): for key, val in info_val.items():
@ -57,7 +57,7 @@ class GeneralTab(tabs.Tab):
cluster.default_image_id) cluster.default_image_id)
if getattr(cluster, 'cluster_template_id', None): if getattr(cluster, 'cluster_template_id', None):
cluster_template = helpers.safe_call(savanna.cluster_templates.get, cluster_template = helpers.safe_call(sahara.cluster_templates.get,
cluster.cluster_template_id) cluster.cluster_template_id)
else: else:
cluster_template = None cluster_template = None
@ -87,14 +87,14 @@ class NodeGroupsTab(tabs.Tab):
def get_context_data(self, request): def get_context_data(self, request):
cluster_id = self.tab_group.kwargs['cluster_id'] cluster_id = self.tab_group.kwargs['cluster_id']
savanna = savannaclient(request) sahara = saharaclient(request)
cluster = savanna.clusters.get(cluster_id) cluster = sahara.clusters.get(cluster_id)
for ng in cluster.node_groups: for ng in cluster.node_groups:
if not ng["flavor_id"]: if not ng["flavor_id"]:
continue continue
ng["flavor_name"] = nova.flavor_get(request, ng["flavor_id"]).name ng["flavor_name"] = nova.flavor_get(request, ng["flavor_id"]).name
ng["node_group_template"] = helpers.safe_call( ng["node_group_template"] = helpers.safe_call(
savanna.node_group_templates.get, sahara.node_group_templates.get,
ng.get("node_group_template_id", None)) ng.get("node_group_template_id", None))
return {"cluster": cluster} return {"cluster": cluster}
@ -135,8 +135,8 @@ class InstancesTab(tabs.TableTab):
def get_cluster_instances_data(self): def get_cluster_instances_data(self):
cluster_id = self.tab_group.kwargs['cluster_id'] cluster_id = self.tab_group.kwargs['cluster_id']
savanna = savannaclient(self.request) sahara = saharaclient(self.request)
cluster = savanna.clusters.get(cluster_id) cluster = sahara.clusters.get(cluster_id)
instances = [] instances = []
for ng in cluster.node_groups: for ng in cluster.node_groups:

View File

@ -19,7 +19,7 @@ from horizon import tables
from horizon import tabs from horizon import tabs
from horizon import workflows from horizon import workflows
from saharadashboard.api.client import client as savannaclient from saharadashboard.api.client import client as saharaclient
from saharadashboard.clusters.tables import ClustersTable from saharadashboard.clusters.tables import ClustersTable
import saharadashboard.clusters.tabs as _tabs import saharadashboard.clusters.tabs as _tabs
@ -34,8 +34,8 @@ class ClustersView(tables.DataTableView):
template_name = 'clusters/clusters.html' template_name = 'clusters/clusters.html'
def get_data(self): def get_data(self):
savanna = savannaclient(self.request) sahara = saharaclient(self.request)
clusters = savanna.clusters.list() clusters = sahara.clusters.list()
return clusters return clusters
@ -82,8 +82,8 @@ class ScaleClusterView(workflows.WorkflowView):
def get_object(self, *args, **kwargs): def get_object(self, *args, **kwargs):
if not hasattr(self, "_object"): if not hasattr(self, "_object"):
template_id = self.kwargs['cluster_id'] template_id = self.kwargs['cluster_id']
savanna = savannaclient(self.request) sahara = saharaclient(self.request)
template = savanna.cluster_templates.get(template_id) template = sahara.cluster_templates.get(template_id)
self._object = template self._object = template
return self._object return self._object

View File

@ -31,7 +31,7 @@ nova = importutils.import_any('openstack_dashboard.api.nova',
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from saharadashboard.api import client as savannaclient from saharadashboard.api import client as saharaclient
from saharadashboard.api.client import SAVANNA_USE_NEUTRON from saharadashboard.api.client import SAVANNA_USE_NEUTRON
import saharadashboard.cluster_templates.workflows.create as t_flows import saharadashboard.cluster_templates.workflows.create as t_flows
from savannaclient.api import base as api_base from savannaclient.api import base as api_base
@ -108,14 +108,14 @@ class GeneralConfigAction(workflows.Action):
) )
def populate_image_choices(self, request, context): def populate_image_choices(self, request, context):
savanna = savannaclient.client(request) sahara = saharaclient.client(request)
all_images = savanna.images.list() all_images = sahara.images.list()
plugin, hadoop_version = whelpers.\ plugin, hadoop_version = whelpers.\
get_plugin_and_hadoop_version(request) get_plugin_and_hadoop_version(request)
details = savanna.plugins.get_version_details(plugin, details = sahara.plugins.get_version_details(plugin,
hadoop_version) hadoop_version)
return [(image.id, image.name) for image in all_images return [(image.id, image.name) for image in all_images
if set(details.required_image_tags).issubset(set(image.tags))] if set(details.required_image_tags).issubset(set(image.tags))]
@ -127,8 +127,8 @@ class GeneralConfigAction(workflows.Action):
return keypair_list return keypair_list
def populate_cluster_template_choices(self, request, context): def populate_cluster_template_choices(self, request, context):
savanna = savannaclient.client(request) sahara = saharaclient.client(request)
templates = savanna.cluster_templates.list() templates = sahara.cluster_templates.list()
plugin, hadoop_version = whelpers.\ plugin, hadoop_version = whelpers.\
get_plugin_and_hadoop_version(request) get_plugin_and_hadoop_version(request)
@ -194,7 +194,7 @@ class ConfigureCluster(whelpers.StatusFormatMixin, workflows.Workflow):
def handle(self, request, context): def handle(self, request, context):
try: try:
savanna = savannaclient.client(request) sahara = saharaclient.client(request)
#TODO(nkonovalov) Implement AJAX Node Groups #TODO(nkonovalov) Implement AJAX Node Groups
node_groups = None node_groups = None
@ -204,7 +204,7 @@ class ConfigureCluster(whelpers.StatusFormatMixin, workflows.Workflow):
cluster_template_id = context["general_cluster_template"] or None cluster_template_id = context["general_cluster_template"] or None
user_keypair = context["general_keypair"] or None user_keypair = context["general_keypair"] or None
savanna.clusters.create( sahara.clusters.create(
context["general_cluster_name"], context["general_cluster_name"],
plugin, hadoop_version, plugin, hadoop_version,
cluster_template_id=cluster_template_id, cluster_template_id=cluster_template_id,

View File

@ -19,7 +19,7 @@ import logging
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from horizon import exceptions from horizon import exceptions
from saharadashboard.api import client as savannaclient from saharadashboard.api import client as saharaclient
from savannaclient.api import base as api_base from savannaclient.api import base as api_base
import saharadashboard.cluster_templates.workflows.create as clt_create_flow import saharadashboard.cluster_templates.workflows.create as clt_create_flow
@ -45,10 +45,10 @@ class ScaleCluster(cl_create_flow.ConfigureCluster,
def __init__(self, request, context_seed, entry_point, *args, **kwargs): def __init__(self, request, context_seed, entry_point, *args, **kwargs):
ScaleCluster._cls_registry = set([]) ScaleCluster._cls_registry = set([])
savanna = savannaclient.client(request) sahara = saharaclient.client(request)
cluster_id = context_seed["cluster_id"] cluster_id = context_seed["cluster_id"]
cluster = savanna.clusters.get(cluster_id) cluster = sahara.clusters.get(cluster_id)
self.success_message = "Scaling Cluster %s successfully started" \ self.success_message = "Scaling Cluster %s successfully started" \
% cluster.name % cluster.name
@ -108,9 +108,9 @@ class ScaleCluster(cl_create_flow.ConfigureCluster,
return self.success_message return self.success_message
def handle(self, request, context): def handle(self, request, context):
savanna = savannaclient.client(request) sahara = saharaclient.client(request)
cluster_id = request.GET["cluster_id"] cluster_id = request.GET["cluster_id"]
cluster = savanna.clusters.get(cluster_id) cluster = sahara.clusters.get(cluster_id)
existing_node_groups = set([]) existing_node_groups = set([])
for ng in cluster.node_groups: for ng in cluster.node_groups:
@ -149,7 +149,7 @@ class ScaleCluster(cl_create_flow.ConfigureCluster,
"count": int(count)} "count": int(count)}
) )
try: try:
savanna.clusters.scale(cluster_id, scale_object) sahara.clusters.scale(cluster_id, scale_object)
return True return True
except api_base.APIException as e: except api_base.APIException as e:
self.error_description = str(e) self.error_description = str(e)

View File

@ -19,7 +19,7 @@ from django.utils.translation import ugettext_lazy as _
from horizon import tables from horizon import tables
from saharadashboard.api.client import client as savannaclient from saharadashboard.api.client import client as saharaclient
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -40,8 +40,8 @@ class DeleteDataSource(tables.BatchAction):
classes = ('btn-danger', 'btn-terminate') classes = ('btn-danger', 'btn-terminate')
def action(self, request, obj_id): def action(self, request, obj_id):
savanna = savannaclient(request) sahara = saharaclient(request)
savanna.data_sources.delete(obj_id) sahara.data_sources.delete(obj_id)
class DataSourcesTable(tables.DataTable): class DataSourcesTable(tables.DataTable):

View File

@ -19,7 +19,7 @@ from django.utils.translation import ugettext_lazy as _
from horizon import tabs from horizon import tabs
from saharadashboard.api.client import client as savannaclient from saharadashboard.api.client import client as saharaclient
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -31,8 +31,8 @@ class GeneralTab(tabs.Tab):
def get_context_data(self, request): def get_context_data(self, request):
data_source_id = self.tab_group.kwargs['data_source_id'] data_source_id = self.tab_group.kwargs['data_source_id']
savanna = savannaclient(request) sahara = saharaclient(request)
data_source = savanna.data_sources.get(data_source_id) data_source = sahara.data_sources.get(data_source_id)
return {"data_source": data_source} return {"data_source": data_source}

View File

@ -19,7 +19,7 @@ from horizon import tables
from horizon import tabs from horizon import tabs
from horizon import workflows from horizon import workflows
from saharadashboard.api.client import client as savannaclient from saharadashboard.api.client import client as saharaclient
from saharadashboard.data_sources.tables import DataSourcesTable from saharadashboard.data_sources.tables import DataSourcesTable
import saharadashboard.data_sources.tabs as _tabs import saharadashboard.data_sources.tabs as _tabs
@ -33,8 +33,8 @@ class DataSourcesView(tables.DataTableView):
template_name = 'data_sources/data_sources.html' template_name = 'data_sources/data_sources.html'
def get_data(self): def get_data(self):
savanna = savannaclient(self.request) sahara = saharaclient(self.request)
data_sources = savanna.data_sources.list() data_sources = sahara.data_sources.list()
return data_sources return data_sources

View File

@ -24,7 +24,7 @@ from django.utils.translation import ugettext as _
from horizon import forms from horizon import forms
from horizon import workflows from horizon import workflows
from saharadashboard.api.client import client as savannaclient from saharadashboard.api.client import client as saharaclient
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -111,8 +111,8 @@ class CreateDataSource(workflows.Workflow):
default_steps = (GeneralConfig, ) default_steps = (GeneralConfig, )
def handle(self, request, context): def handle(self, request, context):
savanna = savannaclient(request) sahara = saharaclient(request)
savanna.data_sources.create( sahara.data_sources.create(
context["general_data_source_name"], context["general_data_source_name"],
context["general_data_source_description"], context["general_data_source_description"],
context["general_data_source_type"], context["general_data_source_type"],

View File

@ -20,7 +20,7 @@ from horizon import exceptions
from horizon import forms from horizon import forms
from horizon import messages from horizon import messages
from saharadashboard.api import client as savannaclient from saharadashboard.api import client as saharaclient
from saharadashboard.utils import importutils from saharadashboard.utils import importutils
from savannaclient.api import base as api_base from savannaclient.api import base as api_base
@ -41,15 +41,15 @@ class ImageForm(forms.SelfHandlingForm):
def handle(self, request, data): def handle(self, request, data):
try: try:
savanna = savannaclient.client(request) sahara = saharaclient.client(request)
image_id = data['image_id'] image_id = data['image_id']
user_name = data['user_name'] user_name = data['user_name']
desc = data['description'] desc = data['description']
savanna.images.update_image(image_id, user_name, desc) sahara.images.update_image(image_id, user_name, desc)
image_tags = json.loads(data["tags_list"]) image_tags = json.loads(data["tags_list"])
savanna.images.update_tags(image_id, image_tags) sahara.images.update_tags(image_id, image_tags)
messages.success(request, self.message) messages.success(request, self.message)
@ -114,8 +114,8 @@ class RegisterImageForm(ImageForm):
final_images = [] final_images = []
savanna = savannaclient.client(request) sahara = saharaclient.client(request)
image_ids = [img.id for img in savanna.images.list()] image_ids = [img.id for img in sahara.images.list()]
for image in images: for image in images:
if image.id not in image_ids: if image.id not in image_ids:

View File

@ -20,7 +20,7 @@ from django.utils.translation import ugettext_lazy as _
from horizon import tables from horizon import tables
from saharadashboard.api.client import client as savannaclient from saharadashboard.api.client import client as saharaclient
from saharadashboard.utils import compatibility from saharadashboard.utils import compatibility
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -55,8 +55,8 @@ class UnregisterImages(tables.BatchAction):
classes = ('btn-danger', 'btn-terminate') classes = ('btn-danger', 'btn-terminate')
def action(self, request, obj_id): def action(self, request, obj_id):
savanna = savannaclient(request) sahara = saharaclient(request)
savanna.images.unregister_image(obj_id) sahara.images.unregister_image(obj_id)
class ImageRegistryTable(tables.DataTable): class ImageRegistryTable(tables.DataTable):

View File

@ -20,7 +20,7 @@ from django.core.urlresolvers import reverse_lazy
from horizon import forms from horizon import forms
from horizon import tables from horizon import tables
from saharadashboard.api.client import client as savannaclient from saharadashboard.api.client import client as saharaclient
from saharadashboard.image_registry.forms import EditTagsForm from saharadashboard.image_registry.forms import EditTagsForm
from saharadashboard.image_registry.forms import RegisterImageForm from saharadashboard.image_registry.forms import RegisterImageForm
from saharadashboard.image_registry.tables import ImageRegistryTable from saharadashboard.image_registry.tables import ImageRegistryTable
@ -34,22 +34,22 @@ class ImageRegistryView(tables.DataTableView):
template_name = 'image_registry/image_registry.html' template_name = 'image_registry/image_registry.html'
def get_data(self): def get_data(self):
savanna = savannaclient(self.request) sahara = saharaclient(self.request)
return savanna.images.list() return sahara.images.list()
def update_context_with_plugin_tags(request, context): def update_context_with_plugin_tags(request, context):
savanna = savannaclient(request) sahara = saharaclient(request)
plugins = savanna.plugins.list() plugins = sahara.plugins.list()
plugins_object = dict() plugins_object = dict()
for plugin in plugins: for plugin in plugins:
plugins_object[plugin.name] = dict() plugins_object[plugin.name] = dict()
for version in plugin.versions: for version in plugin.versions:
plugins_object[plugin.name][version] = [] plugins_object[plugin.name][version] = []
details = savanna.plugins.get_version_details(plugin.name, details = sahara.plugins.get_version_details(plugin.name,
version) version)
for tag in details.required_image_tags: for tag in details.required_image_tags:
plugins_object[plugin.name][version].append(tag) plugins_object[plugin.name][version].append(tag)
@ -70,8 +70,8 @@ class EditTagsView(forms.ModalFormView):
return context return context
def get_object(self): def get_object(self):
savanna = savannaclient(self.request) sahara = saharaclient(self.request)
return savanna.images.get(self.kwargs["image_id"]) return sahara.images.get(self.kwargs["image_id"])
def get_initial(self): def get_initial(self):
image = self.get_object() image = self.get_object()

View File

@ -28,7 +28,7 @@ from django.utils.translation import ugettext as _
from horizon import forms from horizon import forms
from horizon import messages from horizon import messages
from saharadashboard.api import client as savannaclient from saharadashboard.api import client as saharaclient
from savannaclient.api import base as api_base from savannaclient.api import base as api_base
import uuid import uuid
@ -59,8 +59,8 @@ class JobBinaryCreateForm(forms.SelfHandlingForm):
job_binary_url = forms.CharField(label=_("URL"), job_binary_url = forms.CharField(label=_("URL"),
required=False, required=False,
widget=LabeledInput()) widget=LabeledInput())
job_binary_savanna_internal = forms.ChoiceField(label=_("Internal binary"), job_binary_internal = forms.ChoiceField(label=_("Internal binary"),
required=False) required=False)
job_binary_file = forms.FileField(label=_("Upload File"), job_binary_file = forms.FileField(label=_("Upload File"),
required=False) required=False)
@ -93,12 +93,12 @@ class JobBinaryCreateForm(forms.SelfHandlingForm):
[("savanna-db", "Internal database"), [("savanna-db", "Internal database"),
("swift", "Swift")] ("swift", "Swift")]
self.fields["job_binary_savanna_internal"].choices =\ self.fields["job_binary_internal"].choices =\
self.populate_job_binary_savanna_internal_choices(request) self.populate_job_binary_internal_choices(request)
def populate_job_binary_savanna_internal_choices(self, request): def populate_job_binary_internal_choices(self, request):
savanna = savannaclient.client(request) sahara = saharaclient.client(request)
job_binaries = savanna.job_binary_internals.list() job_binaries = sahara.job_binary_internals.list()
choices = [(job_binary.id, job_binary.name) choices = [(job_binary.id, job_binary.name)
for job_binary in job_binaries] for job_binary in job_binaries]
@ -109,16 +109,16 @@ class JobBinaryCreateForm(forms.SelfHandlingForm):
def handle(self, request, context): def handle(self, request, context):
try: try:
savanna = savannaclient.client(request) sahara = saharaclient.client(request)
extra = {} extra = {}
bin_url = "%s://%s" % (context["job_binary_type"], bin_url = "%s://%s" % (context["job_binary_type"],
context["job_binary_url"]) context["job_binary_url"])
if(context["job_binary_type"] == "savanna-db"): if(context["job_binary_type"] == "savanna-db"):
bin_url = self.handle_savanna(request, context) bin_url = self.handle_internal(request, context)
elif(context["job_binary_type"] == "swift"): elif(context["job_binary_type"] == "swift"):
extra = self.handle_swift(request, context) extra = self.handle_swift(request, context)
savanna.job_binaries.create( sahara.job_binaries.create(
context["job_binary_name"], context["job_binary_name"],
bin_url, bin_url,
context["job_binary_description"], context["job_binary_description"],
@ -148,18 +148,18 @@ class JobBinaryCreateForm(forms.SelfHandlingForm):
help_text_template = \ help_text_template = \
("job_binaries/_create_job_binary_help.html") ("job_binaries/_create_job_binary_help.html")
def handle_savanna(self, request, context): def handle_internal(self, request, context):
result = "" result = ""
savanna = savannaclient.client(request) sahara = saharaclient.client(request)
bin_id = context["job_binary_savanna_internal"] bin_id = context["job_binary_internal"]
if(bin_id == self.UPLOAD_BIN): if(bin_id == self.UPLOAD_BIN):
result = savanna.job_binary_internals.create( result = sahara.job_binary_internals.create(
self.get_unique_binary_name( self.get_unique_binary_name(
request, request.FILES["job_binary_file"].name), request, request.FILES["job_binary_file"].name),
request.FILES["job_binary_file"].read()) request.FILES["job_binary_file"].read())
elif(bin_id == self.NEW_SCRIPT): elif(bin_id == self.NEW_SCRIPT):
result = savanna.job_binary_internals.create( result = sahara.job_binary_internals.create(
self.get_unique_binary_name( self.get_unique_binary_name(
request, context["job_binary_script_name"]), request, context["job_binary_script_name"]),
context["job_binary_script"]) context["job_binary_script"])
@ -178,8 +178,8 @@ class JobBinaryCreateForm(forms.SelfHandlingForm):
return extra return extra
def get_unique_binary_name(self, request, base_name): def get_unique_binary_name(self, request, base_name):
savanna = savannaclient.client(request) sahara = saharaclient.client(request)
internals = savanna.job_binary_internals.list() internals = sahara.job_binary_internals.list()
names = [internal.name for internal in internals] names = [internal.name for internal in internals]
if base_name in names: if base_name in names:
return "%s_%s" % (base_name, uuid.uuid1()) return "%s_%s" % (base_name, uuid.uuid1())

View File

@ -19,7 +19,7 @@ from django.utils.translation import ugettext_lazy as _
from horizon import tables from horizon import tables
from saharadashboard.api import client as savannaclient from saharadashboard.api import client as saharaclient
from savannaclient.api import base as api_base from savannaclient.api import base as api_base
@ -42,18 +42,18 @@ class DeleteJobBinary(tables.BatchAction):
classes = ('btn-danger', 'btn-terminate') classes = ('btn-danger', 'btn-terminate')
def action(self, request, obj_id): def action(self, request, obj_id):
savanna = savannaclient.client(request) sahara = saharaclient.client(request)
jb = savanna.job_binaries.get(obj_id) jb = sahara.job_binaries.get(obj_id)
(jb_type, jb_internal_id) = jb.url.split("://") (jb_type, jb_internal_id) = jb.url.split("://")
if jb_type == "savanna-db": if jb_type == "savanna-db":
try: try:
savanna.job_binary_internals.delete(jb_internal_id) sahara.job_binary_internals.delete(jb_internal_id)
except api_base.APIException: except api_base.APIException:
# nothing to do for job-binary-internal if # nothing to do for job-binary-internal if
# it does not exist. # it does not exist.
pass pass
savanna.job_binaries.delete(obj_id) sahara.job_binaries.delete(obj_id)
class DownloadJobBinary(tables.LinkAction): class DownloadJobBinary(tables.LinkAction):

View File

@ -19,7 +19,7 @@ from django.utils.translation import ugettext_lazy as _
from horizon import tabs from horizon import tabs
from saharadashboard.api.client import client as savannaclient from saharadashboard.api.client import client as saharaclient
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -31,8 +31,8 @@ class GeneralTab(tabs.Tab):
def get_context_data(self, request): def get_context_data(self, request):
job_binary_id = self.tab_group.kwargs['job_binary_id'] job_binary_id = self.tab_group.kwargs['job_binary_id']
savanna = savannaclient(request) sahara = saharaclient(request)
job_binary = savanna.job_binaries.get(job_binary_id) job_binary = sahara.job_binaries.get(job_binary_id)
return {"job_binary": job_binary} return {"job_binary": job_binary}

View File

@ -27,7 +27,7 @@ from horizon import forms
from horizon import tables from horizon import tables
from horizon import tabs from horizon import tabs
from saharadashboard.api.client import client as savannaclient from saharadashboard.api.client import client as saharaclient
import saharadashboard.job_binaries.forms as job_binary_forms import saharadashboard.job_binaries.forms as job_binary_forms
from saharadashboard.job_binaries.tables import JobBinariesTable from saharadashboard.job_binaries.tables import JobBinariesTable
@ -42,8 +42,8 @@ class JobBinariesView(tables.DataTableView):
template_name = 'job_binaries/job_binaries.html' template_name = 'job_binaries/job_binaries.html'
def get_data(self): def get_data(self):
savanna = savannaclient(self.request) sahara = saharaclient(self.request)
job_binaries = savanna.job_binaries.list() job_binaries = sahara.job_binaries.list()
return job_binaries return job_binaries
@ -70,9 +70,9 @@ class JobBinaryDetailsView(tabs.TabView):
class DownloadJobBinaryView(View): class DownloadJobBinaryView(View):
def get(self, request, job_binary_id=None): def get(self, request, job_binary_id=None):
try: try:
savanna = savannaclient(request) sahara = saharaclient(request)
jb = savanna.job_binaries.get(job_binary_id) jb = sahara.job_binaries.get(job_binary_id)
data = savanna.job_binaries.get_file(job_binary_id) data = sahara.job_binaries.get_file(job_binary_id)
except Exception: except Exception:
redirect = reverse('horizon:sahara:job_binaries:index') redirect = reverse('horizon:sahara:job_binaries:index')
exceptions.handle(self.request, exceptions.handle(self.request,

View File

@ -21,7 +21,7 @@ from django.utils.translation import ugettext_lazy as _
from horizon import tables from horizon import tables
from saharadashboard.api.client import client as savannaclient from saharadashboard.api.client import client as saharaclient
from saharadashboard.jobs import tables as j_t from saharadashboard.jobs import tables as j_t
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -36,8 +36,8 @@ class DeleteJobExecution(tables.BatchAction):
classes = ('btn-danger', 'btn-terminate') classes = ('btn-danger', 'btn-terminate')
def action(self, request, obj_id): def action(self, request, obj_id):
savanna = savannaclient(request) sahara = saharaclient(request)
savanna.job_executions.delete(obj_id) sahara.job_executions.delete(obj_id)
class ReLaunchJobExistingCluster(j_t.ChoosePlugin): class ReLaunchJobExistingCluster(j_t.ChoosePlugin):
@ -73,8 +73,8 @@ class UpdateRow(tables.Row):
ajax = True ajax = True
def get_data(self, request, job_execution_id): def get_data(self, request, job_execution_id):
savanna = savannaclient(request) sahara = saharaclient(request)
job_execution = savanna.job_executions.get(job_execution_id) job_execution = sahara.job_executions.get(job_execution_id)
return job_execution return job_execution

View File

@ -19,7 +19,7 @@ from django.utils.translation import ugettext_lazy as _
from horizon import tabs from horizon import tabs
from saharadashboard.api.client import client as savannaclient from saharadashboard.api.client import client as saharaclient
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -31,9 +31,9 @@ class GeneralTab(tabs.Tab):
def get_context_data(self, request): def get_context_data(self, request):
job_execution_id = self.tab_group.kwargs['job_execution_id'] job_execution_id = self.tab_group.kwargs['job_execution_id']
savanna = savannaclient(request) sahara = saharaclient(request)
job_execution = savanna.job_executions.get(job_execution_id) job_execution = sahara.job_executions.get(job_execution_id)
object_names = self.get_object_names(job_execution, savanna) object_names = self.get_object_names(job_execution, sahara)
return {"job_execution": job_execution, return {"job_execution": job_execution,
"object_names": object_names} "object_names": object_names}
@ -56,15 +56,15 @@ class GeneralTab(tabs.Tab):
return object_names return object_names
def get_object_name(self, obj_id, savanna_obj, s_client): def get_object_name(self, obj_id, sahara_obj, s_client):
object_name = None object_name = None
try: try:
s_obj = getattr(s_client, savanna_obj) s_obj = getattr(s_client, sahara_obj)
obj = s_obj.get(obj_id) obj = s_obj.get(obj_id)
object_name = obj.name object_name = obj.name
except Exception as e: except Exception as e:
LOG.warn("Unable to get name for %s with object_id %s (%s)" % LOG.warn("Unable to get name for %s with object_id %s (%s)" %
(savanna_obj, obj_id, str(e))) (sahara_obj, obj_id, str(e)))
return object_name return object_name

View File

@ -18,7 +18,7 @@ import logging
from horizon import tables from horizon import tables
from horizon import tabs from horizon import tabs
from saharadashboard.api.client import client as savannaclient from saharadashboard.api.client import client as saharaclient
from saharadashboard.job_executions.tables import JobExecutionsTable from saharadashboard.job_executions.tables import JobExecutionsTable
import saharadashboard.job_executions.tabs as _tabs import saharadashboard.job_executions.tabs as _tabs
@ -31,8 +31,8 @@ class JobExecutionsView(tables.DataTableView):
template_name = 'job_executions/job_executions.html' template_name = 'job_executions/job_executions.html'
def get_data(self): def get_data(self):
savanna = savannaclient(self.request) sahara = saharaclient(self.request)
jobs = savanna.job_executions.list() jobs = sahara.job_executions.list()
return jobs return jobs

View File

@ -21,7 +21,7 @@ from django.utils.translation import ugettext_lazy as _
from horizon import tables from horizon import tables
from saharadashboard.api.client import client as savannaclient from saharadashboard.api.client import client as saharaclient
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -42,8 +42,8 @@ class DeleteJob(tables.BatchAction):
classes = ('btn-danger', 'btn-terminate') classes = ('btn-danger', 'btn-terminate')
def action(self, request, obj_id): def action(self, request, obj_id):
savanna = savannaclient(request) sahara = saharaclient(request)
savanna.jobs.delete(obj_id) sahara.jobs.delete(obj_id)
class LaunchJobExistingCluster(tables.LinkAction): class LaunchJobExistingCluster(tables.LinkAction):

View File

@ -19,7 +19,7 @@ from django.utils.translation import ugettext_lazy as _
from horizon import tabs from horizon import tabs
from saharadashboard.api.client import client as savannaclient from saharadashboard.api.client import client as saharaclient
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -31,8 +31,8 @@ class GeneralTab(tabs.Tab):
def get_context_data(self, request): def get_context_data(self, request):
job_id = self.tab_group.kwargs['job_id'] job_id = self.tab_group.kwargs['job_id']
savanna = savannaclient(request) sahara = saharaclient(request)
job = savanna.jobs.get(job_id) job = sahara.jobs.get(job_id)
return {"job": job} return {"job": job}

View File

@ -21,7 +21,7 @@ from horizon import tables
from horizon import tabs from horizon import tabs
from horizon import workflows from horizon import workflows
from saharadashboard.api.client import client as savannaclient from saharadashboard.api.client import client as saharaclient
import saharadashboard.jobs.tables as _tables import saharadashboard.jobs.tables as _tables
import saharadashboard.jobs.tabs as _tabs import saharadashboard.jobs.tabs as _tabs
@ -36,8 +36,8 @@ class JobsView(tables.DataTableView):
template_name = 'jobs/jobs.html' template_name = 'jobs/jobs.html'
def get_data(self): def get_data(self):
savanna = savannaclient(self.request) sahara = saharaclient(self.request)
jobs = savanna.jobs.list() jobs = sahara.jobs.list()
return jobs return jobs
@ -70,8 +70,8 @@ class LaunchJobView(workflows.WorkflowView):
if request.is_ajax(): if request.is_ajax():
if request.REQUEST.get("json", None): if request.REQUEST.get("json", None):
job_id = request.REQUEST.get("job_id") job_id = request.REQUEST.get("job_id")
savanna = savannaclient(request) sahara = saharaclient(request)
job_type = savanna.jobs.get(job_id).type job_type = sahara.jobs.get(job_id).type
return HttpResponse(json.dumps({"job_type": job_type}), return HttpResponse(json.dumps({"job_type": job_type}),
mimetype='application/json') mimetype='application/json')
return super(LaunchJobView, self).get(request, args, kwargs) return super(LaunchJobView, self).get(request, args, kwargs)

View File

@ -21,7 +21,7 @@ from django.utils.translation import ugettext as _
from horizon import forms from horizon import forms
from horizon import workflows from horizon import workflows
from saharadashboard.api.client import client as savannaclient from saharadashboard.api.client import client as saharaclient
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -37,8 +37,8 @@ class AdditionalLibsAction(workflows.Action):
widget=forms.HiddenInput()) widget=forms.HiddenInput())
def populate_lib_binaries_choices(self, request, context): def populate_lib_binaries_choices(self, request, context):
savanna = savannaclient(request) sahara = saharaclient(request)
job_binaries = savanna.job_binaries.list() job_binaries = sahara.job_binaries.list()
choices = [(job_binary.id, job_binary.name) choices = [(job_binary.id, job_binary.name)
for job_binary in job_binaries] for job_binary in job_binaries]
@ -77,8 +77,8 @@ class GeneralConfigAction(workflows.Action):
return choices return choices
def populate_main_binary_choices(self, request, context): def populate_main_binary_choices(self, request, context):
savanna = savannaclient(request) sahara = saharaclient(request)
job_binaries = savanna.job_binaries.list() job_binaries = sahara.job_binaries.list()
choices = [(job_binary.id, job_binary.name) choices = [(job_binary.id, job_binary.name)
for job_binary in job_binaries] for job_binary in job_binaries]
@ -125,7 +125,7 @@ class CreateJob(workflows.Workflow):
default_steps = (GeneralConfig, ConfigureLibs) default_steps = (GeneralConfig, ConfigureLibs)
def handle(self, request, context): def handle(self, request, context):
savanna = savannaclient(request) sahara = saharaclient(request)
main_locations = [] main_locations = []
lib_locations = [] lib_locations = []
@ -136,7 +136,7 @@ class CreateJob(workflows.Workflow):
if context.get("main_binary", None): if context.get("main_binary", None):
main_locations.append(context["main_binary"]) main_locations.append(context["main_binary"])
savanna.jobs.create( sahara.jobs.create(
context["job_name"], context["job_name"],
context["job_type"], context["job_type"],
main_locations, main_locations,

View File

@ -21,7 +21,7 @@ from django.utils.translation import ugettext as _
from horizon import forms from horizon import forms
from horizon import workflows from horizon import workflows
from saharadashboard.api.client import client as savannaclient from saharadashboard.api.client import client as saharaclient
import saharadashboard.cluster_templates.workflows.create as t_flows import saharadashboard.cluster_templates.workflows.create as t_flows
import saharadashboard.clusters.workflows.create as c_flow import saharadashboard.clusters.workflows.create as c_flow
import saharadashboard.utils.workflow_helpers as whelpers import saharadashboard.utils.workflow_helpers as whelpers
@ -75,8 +75,8 @@ class JobExecutionGeneralConfigAction(workflows.Action):
return self.get_data_source_choices(request, context) return self.get_data_source_choices(request, context)
def get_data_source_choices(self, request, context): def get_data_source_choices(self, request, context):
savanna = savannaclient(request) sahara = saharaclient(request)
data_sources = savanna.data_sources.list() data_sources = sahara.data_sources.list()
choices = [(data_source.id, data_source.name) choices = [(data_source.id, data_source.name)
for data_source in data_sources] for data_source in data_sources]
@ -85,8 +85,8 @@ class JobExecutionGeneralConfigAction(workflows.Action):
return choices return choices
def populate_job_choices(self, request): def populate_job_choices(self, request):
savanna = savannaclient(request) sahara = saharaclient(request)
jobs = savanna.jobs.list() jobs = sahara.jobs.list()
choices = [(job.id, job.name) choices = [(job.id, job.name)
for job in jobs] for job in jobs]
@ -106,8 +106,8 @@ class JobExecutionExistingGeneralConfigAction(JobExecutionGeneralConfigAction):
widget=forms.Select(attrs={"class": "cluster_choice"})) widget=forms.Select(attrs={"class": "cluster_choice"}))
def populate_cluster_choices(self, request, context): def populate_cluster_choices(self, request, context):
savanna = savannaclient(request) sahara = saharaclient(request)
clusters = savanna.clusters.list() clusters = sahara.clusters.list()
choices = [(cluster.id, cluster.name) choices = [(cluster.id, cluster.name)
for cluster in clusters] for cluster in clusters]
@ -162,7 +162,7 @@ class JobConfigAction(workflows.Action):
super(JobConfigAction, self).__init__(request, *args, **kwargs) super(JobConfigAction, self).__init__(request, *args, **kwargs)
job_ex_id = request.REQUEST.get("job_execution_id") job_ex_id = request.REQUEST.get("job_execution_id")
if job_ex_id is not None: if job_ex_id is not None:
client = savannaclient(request) client = saharaclient(request)
job_ex_id = request.REQUEST.get("job_execution_id") job_ex_id = request.REQUEST.get("job_execution_id")
job_ex = client.job_executions.get(job_ex_id) job_ex = client.job_executions.get(job_ex_id)
job_configs = job_ex.job_configs job_configs = job_ex.job_configs
@ -207,7 +207,7 @@ class JobConfigAction(workflows.Action):
return cleaned_data return cleaned_data
def populate_property_name_choices(self, request, context): def populate_property_name_choices(self, request, context):
client = savannaclient(request) client = saharaclient(request)
job_id = request.REQUEST.get("job_id") or request.REQUEST.get("job") job_id = request.REQUEST.get("job_id") or request.REQUEST.get("job")
job_type = client.jobs.get(job_id).type job_type = client.jobs.get(job_id).type
job_configs = client.jobs.get_configs(job_type).job_config job_configs = client.jobs.get_configs(job_type).job_config
@ -332,9 +332,9 @@ class LaunchJob(workflows.Workflow):
default_steps = (JobExecutionExistingGeneralConfig, JobConfig) default_steps = (JobExecutionExistingGeneralConfig, JobConfig)
def handle(self, request, context): def handle(self, request, context):
savanna = savannaclient(request) sahara = saharaclient(request)
savanna.job_executions.create( sahara.job_executions.create(
context["job_general_job"], context["job_general_job"],
context["job_general_cluster"], context["job_general_cluster"],
context["job_general_job_input"], context["job_general_job_input"],
@ -378,7 +378,7 @@ class SelectHadoopPluginAction(t_flows.SelectPluginAction):
widget=forms.HiddenInput( widget=forms.HiddenInput(
attrs={"class": "hidden_create_field"})) attrs={"class": "hidden_create_field"}))
client = savannaclient(request) client = saharaclient(request)
job_ex_id = request.REQUEST.get("job_execution_id") job_ex_id = request.REQUEST.get("job_execution_id")
job_configs = client.job_executions.get(job_ex_id).job_configs job_configs = client.job_executions.get(job_ex_id).job_configs
@ -423,7 +423,7 @@ class LaunchJobNewCluster(workflows.Workflow):
JobConfig) JobConfig)
def handle(self, request, context): def handle(self, request, context):
savanna = savannaclient(request) sahara = saharaclient(request)
node_groups = None node_groups = None
plugin, hadoop_version = ( plugin, hadoop_version = (
@ -432,7 +432,7 @@ class LaunchJobNewCluster(workflows.Workflow):
ct_id = context["cluster_general_cluster_template"] or None ct_id = context["cluster_general_cluster_template"] or None
user_keypair = context["cluster_general_keypair"] or None user_keypair = context["cluster_general_keypair"] or None
cluster = savanna.clusters.create( cluster = sahara.clusters.create(
context["cluster_general_cluster_name"], context["cluster_general_cluster_name"],
plugin, hadoop_version, plugin, hadoop_version,
cluster_template_id=ct_id, cluster_template_id=ct_id,
@ -444,7 +444,7 @@ class LaunchJobNewCluster(workflows.Workflow):
net_id=context.get("cluster_general_neutron_management_network", net_id=context.get("cluster_general_neutron_management_network",
None)) None))
savanna.job_executions.create( sahara.job_executions.create(
context["job_general_job"], context["job_general_job"],
cluster.id, cluster.id,
context["job_general_job_input"], context["job_general_job_input"],

View File

@ -19,7 +19,7 @@ import logging
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from horizon import tables from horizon import tables
from saharadashboard.api.client import client as savannaclient from saharadashboard.api.client import client as saharaclient
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -60,8 +60,8 @@ class DeleteTemplate(tables.BatchAction):
return True return True
def action(self, request, template_id): def action(self, request, template_id):
savanna = savannaclient(request) sahara = saharaclient(request)
savanna.node_group_templates.delete(template_id) sahara.node_group_templates.delete(template_id)
def render_processes(nodegroup_template): def render_processes(nodegroup_template):

View File

@ -18,7 +18,7 @@ import logging
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from horizon import tabs from horizon import tabs
from saharadashboard.api.client import client as savannaclient from saharadashboard.api.client import client as saharaclient
from saharadashboard.utils import importutils from saharadashboard.utils import importutils
# horizon.api is for backward compatibility with folsom # horizon.api is for backward compatibility with folsom
@ -36,8 +36,8 @@ class GeneralTab(tabs.Tab):
def get_context_data(self, request): def get_context_data(self, request):
template_id = self.tab_group.kwargs['template_id'] template_id = self.tab_group.kwargs['template_id']
savanna = savannaclient(request) sahara = saharaclient(request)
template = savanna.node_group_templates.get(template_id) template = sahara.node_group_templates.get(template_id)
flavor = nova.flavor_get(request, template.flavor_id) flavor = nova.flavor_get(request, template.flavor_id)
return {"template": template, "flavor": flavor} return {"template": template, "flavor": flavor}
@ -49,8 +49,8 @@ class ConfigsTab(tabs.Tab):
def get_context_data(self, request): def get_context_data(self, request):
template_id = self.tab_group.kwargs['template_id'] template_id = self.tab_group.kwargs['template_id']
savanna = savannaclient(request) sahara = saharaclient(request)
template = savanna.node_group_templates.get(template_id) template = sahara.node_group_templates.get(template_id)
return {"template": template} return {"template": template}

View File

@ -19,7 +19,7 @@ from horizon import tables
from horizon import tabs from horizon import tabs
from horizon import workflows from horizon import workflows
from saharadashboard.api.client import client as savannaclient from saharadashboard.api.client import client as saharaclient
import saharadashboard.nodegroup_templates.tables as _tables import saharadashboard.nodegroup_templates.tables as _tables
import saharadashboard.nodegroup_templates.tabs as _tabs import saharadashboard.nodegroup_templates.tabs as _tabs
@ -34,8 +34,8 @@ class NodegroupTemplatesView(tables.DataTableView):
template_name = 'nodegroup_templates/nodegroup_templates.html' template_name = 'nodegroup_templates/nodegroup_templates.html'
def get_data(self): def get_data(self):
savanna = savannaclient(self.request) sahara = saharaclient(self.request)
nodegroup_templates = savanna.node_group_templates.list() nodegroup_templates = sahara.node_group_templates.list()
return nodegroup_templates return nodegroup_templates
@ -81,8 +81,8 @@ class CopyNodegroupTemplateView(workflows.WorkflowView):
def get_object(self, *args, **kwargs): def get_object(self, *args, **kwargs):
if not hasattr(self, "_object"): if not hasattr(self, "_object"):
template_id = self.kwargs['template_id'] template_id = self.kwargs['template_id']
savanna = savannaclient(self.request) sahara = saharaclient(self.request)
template = savanna.node_group_templates.get(template_id) template = sahara.node_group_templates.get(template_id)
self._object = template self._object = template
return self._object return self._object

View File

@ -17,7 +17,7 @@ import logging
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from saharadashboard.api.client import client as savannaclient from saharadashboard.api.client import client as saharaclient
import saharadashboard.nodegroup_templates.workflows.create as create_flow import saharadashboard.nodegroup_templates.workflows.create as create_flow
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -27,10 +27,10 @@ class CopyNodegroupTemplate(create_flow.ConfigureNodegroupTemplate):
success_message = _("Node Group Template copy %s created") success_message = _("Node Group Template copy %s created")
def __init__(self, request, context_seed, entry_point, *args, **kwargs): def __init__(self, request, context_seed, entry_point, *args, **kwargs):
savanna = savannaclient(request) sahara = saharaclient(request)
template_id = context_seed["template_id"] template_id = context_seed["template_id"]
template = savanna.node_group_templates.get(template_id) template = sahara.node_group_templates.get(template_id)
self._set_configs_to_copy(template.node_configs) self._set_configs_to_copy(template.node_configs)
plugin = template.plugin_name plugin = template.plugin_name
@ -65,7 +65,7 @@ class CopyNodegroupTemplate(create_flow.ConfigureNodegroupTemplate):
fields['floating_ip_pool'].initial = template.floating_ip_pool fields['floating_ip_pool'].initial = template.floating_ip_pool
processes_dict = dict() processes_dict = dict()
plugin_details = savanna.plugins.get_version_details( plugin_details = sahara.plugins.get_version_details(
plugin, plugin,
hadoop_version) hadoop_version)
plugin_node_processes = plugin_details.node_processes plugin_node_processes = plugin_details.node_processes

View File

@ -21,7 +21,7 @@ from django.utils.translation import ugettext as _
from horizon import exceptions from horizon import exceptions
from horizon import workflows from horizon import workflows
from saharadashboard.api import client as savannaclient from saharadashboard.api import client as saharaclient
from saharadashboard.utils import importutils from saharadashboard.utils import importutils
from savannaclient.api import base as api_base from savannaclient.api import base as api_base
@ -79,21 +79,21 @@ class GeneralConfigAction(workflows.Action):
def __init__(self, request, *args, **kwargs): def __init__(self, request, *args, **kwargs):
super(GeneralConfigAction, self).__init__(request, *args, **kwargs) super(GeneralConfigAction, self).__init__(request, *args, **kwargs)
savanna = savannaclient.client(request) sahara = saharaclient.client(request)
hlps = helpers.Helpers(savanna) hlps = helpers.Helpers(sahara)
plugin, hadoop_version = whelpers.\ plugin, hadoop_version = whelpers.\
get_plugin_and_hadoop_version(request) get_plugin_and_hadoop_version(request)
process_choices = [] process_choices = []
version_details = savanna.plugins.get_version_details(plugin, version_details = sahara.plugins.get_version_details(plugin,
hadoop_version) hadoop_version)
for service, processes in version_details.node_processes.items(): for service, processes in version_details.node_processes.items():
for process in processes: for process in processes:
process_choices.append( process_choices.append(
(str(service) + ":" + str(process), process)) (str(service) + ":" + str(process), process))
if not savannaclient.AUTO_ASSIGNMENT_ENABLED: if not saharaclient.AUTO_ASSIGNMENT_ENABLED:
pools = network.floating_ip_pools_list(request) pools = network.floating_ip_pools_list(request)
pool_choices = [(pool.id, pool.name) for pool in pools] pool_choices = [(pool.id, pool.name) for pool in pools]
pool_choices.insert(0, (None, "Do not assign floating IPs")) pool_choices.insert(0, (None, "Do not assign floating IPs"))
@ -175,8 +175,8 @@ class ConfigureNodegroupTemplate(whelpers.ServiceParametersWorkflow,
default_steps = (GeneralConfig,) default_steps = (GeneralConfig,)
def __init__(self, request, context_seed, entry_point, *args, **kwargs): def __init__(self, request, context_seed, entry_point, *args, **kwargs):
savanna = savannaclient.client(request) sahara = saharaclient.client(request)
hlps = helpers.Helpers(savanna) hlps = helpers.Helpers(sahara)
plugin, hadoop_version = whelpers.\ plugin, hadoop_version = whelpers.\
get_plugin_and_hadoop_version(request) get_plugin_and_hadoop_version(request)
@ -224,7 +224,7 @@ class ConfigureNodegroupTemplate(whelpers.ServiceParametersWorkflow,
def handle(self, request, context): def handle(self, request, context):
try: try:
savanna = savannaclient.client(request) sahara = saharaclient.client(request)
processes = [] processes = []
for service_process in context["general_processes"]: for service_process in context["general_processes"]:
@ -243,7 +243,7 @@ class ConfigureNodegroupTemplate(whelpers.ServiceParametersWorkflow,
volumes_per_node = context["general_volumes_per_node"] volumes_per_node = context["general_volumes_per_node"]
volumes_size = context["general_volumes_size"] volumes_size = context["general_volumes_size"]
savanna.node_group_templates.create( sahara.node_group_templates.create(
name=context["general_nodegroup_name"], name=context["general_nodegroup_name"],
plugin_name=plugin, plugin_name=plugin,
hadoop_version=hadoop_version, hadoop_version=hadoop_version,
@ -271,8 +271,8 @@ class SelectPluginAction(workflows.Action,
def __init__(self, request, *args, **kwargs): def __init__(self, request, *args, **kwargs):
super(SelectPluginAction, self).__init__(request, *args, **kwargs) super(SelectPluginAction, self).__init__(request, *args, **kwargs)
savanna = savannaclient.client(request) sahara = saharaclient.client(request)
self._generate_plugin_version_fields(savanna) self._generate_plugin_version_fields(sahara)
class Meta: class Meta:
name = _("Select plugin and hadoop version") name = _("Select plugin and hadoop version")

View File

@ -18,7 +18,7 @@ from django.utils.translation import ugettext_lazy as _
import logging import logging
from horizon import tabs from horizon import tabs
from saharadashboard.api.client import client as savannaclient from saharadashboard.api.client import client as saharaclient
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -30,8 +30,8 @@ class DetailsTab(tabs.Tab):
def get_context_data(self, request): def get_context_data(self, request):
plugin_id = self.tab_group.kwargs['plugin_id'] plugin_id = self.tab_group.kwargs['plugin_id']
savanna = savannaclient(request) sahara = saharaclient(request)
plugin = savanna.plugins.get(plugin_id) plugin = sahara.plugins.get(plugin_id)
return {"plugin": plugin} return {"plugin": plugin}

View File

@ -18,7 +18,7 @@ from horizon import tables
from horizon import tabs from horizon import tabs
import logging import logging
from saharadashboard.api.client import client as savannaclient from saharadashboard.api.client import client as saharaclient
from saharadashboard.plugins.tables import PluginsTable from saharadashboard.plugins.tables import PluginsTable
from saharadashboard.plugins.tabs import PluginDetailsTabs from saharadashboard.plugins.tabs import PluginDetailsTabs
@ -30,8 +30,8 @@ class PluginsView(tables.DataTableView):
template_name = 'plugins/plugins.html' template_name = 'plugins/plugins.html'
def get_data(self): def get_data(self):
savanna = savannaclient(self.request) sahara = saharaclient(self.request)
return savanna.plugins.list() return sahara.plugins.list()
class PluginDetailsView(tabs.TabView): class PluginDetailsView(tabs.TabView):

View File

@ -8,12 +8,12 @@
$("[name=job_binary_password]").closest(".control-group").hide(); $("[name=job_binary_password]").closest(".control-group").hide();
$("[name=job_binary_file]").closest(".control-group").hide(); $("[name=job_binary_file]").closest(".control-group").hide();
$("[name=job_binary_url]").closest(".control-group").hide(); $("[name=job_binary_url]").closest(".control-group").hide();
$("[name=job_binary_savanna_internal]").closest(".control-group").hide(); $("[name=job_binary_internal]").closest(".control-group").hide();
} }
$("#id_job_binary_type").change(function() { $("#id_job_binary_type").change(function() {
var label = $("#id_job_binary_url_label"); var label = $("#id_job_binary_url_label");
var bin_file = $("[name=job_binary_file]").closest(".control-group"); var bin_file = $("[name=job_binary_file]").closest(".control-group");
var bin_choice = $("[name=job_binary_savanna_internal]").closest(".control-group"); var bin_choice = $("[name=job_binary_internal]").closest(".control-group");
var bin_url = $("[name=job_binary_url]").closest(".control-group"); var bin_url = $("[name=job_binary_url]").closest(".control-group");
var username = $("[name=job_binary_username]").closest(".control-group"); var username = $("[name=job_binary_username]").closest(".control-group");
var password = $("[name=job_binary_password]").closest(".control-group"); var password = $("[name=job_binary_password]").closest(".control-group");
@ -44,9 +44,9 @@
}); });
$("#id_job_binary_type").change(); $("#id_job_binary_type").change();
$("[name=job_binary_savanna_internal]").change(function() { $("[name=job_binary_internal]").change(function() {
var bin_file = $("[name=job_binary_file]").closest(".control-group"); var bin_file = $("[name=job_binary_file]").closest(".control-group");
var bin_choice = $("[name=job_binary_savanna_internal]").closest(".control-group"); var bin_choice = $("[name=job_binary_internal]").closest(".control-group");
var bin_url = $("[name=job_binary_url]").closest(".control-group"); var bin_url = $("[name=job_binary_url]").closest(".control-group");
var script_name = $("[name=job_binary_script_name]").closest(".control-group"); var script_name = $("[name=job_binary_script_name]").closest(".control-group");
var script_text = $("[name=job_binary_script]").closest(".control-group"); var script_text = $("[name=job_binary_script]").closest(".control-group");
@ -68,7 +68,7 @@
break; break;
} }
}); });
$("#job_binary_savanna_internal").change(); $("#job_binary_internal").change();
}); });
}); });
</script> </script>

View File

@ -250,16 +250,16 @@ class UITestCase(unittest2.TestCase):
cfg.common.password) cfg.common.password)
elif storage_type == 'Internal database': elif storage_type == 'Internal database':
savanna_binary = parameters_of_storage['Internal binary'] internal_binary = parameters_of_storage['Internal binary']
driver.find_element_by_xpath( driver.find_element_by_xpath(
"//select[@id='id_job_binary_savanna_internal']/option[text()" "//select[@id='id_job_binary_internal']/option[text()"
"='%s']" % savanna_binary).click() "='%s']" % internal_binary).click()
if savanna_binary == '*Upload a new file': if internal_binary == '*Upload a new file':
file = '%s/saharadashboard/tests/resources/%s' % ( file = '%s/saharadashboard/tests/resources/%s' % (
os.getcwd(), parameters_of_storage['filename']) os.getcwd(), parameters_of_storage['filename'])
driver.find_element_by_id('id_job_binary_file').send_keys(file) driver.find_element_by_id('id_job_binary_file').send_keys(file)
elif savanna_binary == '*Create a script': elif internal_binary == '*Create a script':
self.find_clear_send(by.By.ID, "id_job_binary_script_name", self.find_clear_send(by.By.ID, "id_job_binary_script_name",
parameters_of_storage['script_name']) parameters_of_storage['script_name'])
self.find_clear_send(by.By.ID, "id_job_binary_script", self.find_clear_send(by.By.ID, "id_job_binary_script",

View File

@ -21,7 +21,7 @@ common_group = cfg.OptGroup(name='common', title="common configs")
CommonGroup = [ CommonGroup = [
cfg.StrOpt('base_url', cfg.StrOpt('base_url',
default='http://127.0.0.1:8080', default='http://127.0.0.1:8080',
help="savanna url"), help="sahara url"),
cfg.StrOpt('user', cfg.StrOpt('user',
default='admin', default='admin',
help="keystone user"), help="keystone user"),
@ -88,7 +88,7 @@ VanillaGroup = [
cfg.DictOpt('processes', cfg.DictOpt('processes',
default={"NN": 0, "DN": 1, "SNN": 2, default={"NN": 0, "DN": 1, "SNN": 2,
"OZ": 3, "TT": 4, "JT": 5}, "OZ": 3, "TT": 4, "JT": 5},
help='numbers of processes for vanilla in savannabashboard'), help='numbers of processes for vanilla in saharadashboard'),
cfg.StrOpt('base_image', cfg.StrOpt('base_image',
default='ubuntu_savanna_latest', default='ubuntu_savanna_latest',
help="image name for start vanilla cluster") help="image name for start vanilla cluster")

View File

@ -19,7 +19,7 @@ from django.utils.translation import ugettext as _
from horizon import forms from horizon import forms
from saharadashboard.api.client import client as savannaclient from saharadashboard.api.client import client as saharaclient
import saharadashboard.utils.workflow_helpers as whelpers import saharadashboard.utils.workflow_helpers as whelpers
@ -36,10 +36,10 @@ def anti_affinity_field():
def populate_anti_affinity_choices(self, request, context): def populate_anti_affinity_choices(self, request, context):
savanna = savannaclient(request) sahara = saharaclient(request)
plugin, version = whelpers.get_plugin_and_hadoop_version(request) plugin, version = whelpers.get_plugin_and_hadoop_version(request)
version_details = savanna.plugins.get_version_details(plugin, version) version_details = sahara.plugins.get_version_details(plugin, version)
process_choices = [] process_choices = []
for service, processes in version_details.node_processes.items(): for service, processes in version_details.node_processes.items():
for process in processes: for process in processes:
@ -49,7 +49,7 @@ def populate_anti_affinity_choices(self, request, context):
if cluster_template_id is None: if cluster_template_id is None:
selected_processes = request.REQUEST.get("aa_groups", []) selected_processes = request.REQUEST.get("aa_groups", [])
else: else:
cluster_template = savanna.cluster_templates.get(cluster_template_id) cluster_template = sahara.cluster_templates.get(cluster_template_id)
selected_processes = cluster_template.anti_affinity selected_processes = cluster_template.anti_affinity
checked_dict = dict() checked_dict = dict()

View File

@ -149,8 +149,8 @@ def get_plugin_and_hadoop_version(request):
class PluginAndVersionMixin(object): class PluginAndVersionMixin(object):
def _generate_plugin_version_fields(self, savanna): def _generate_plugin_version_fields(self, sahara):
plugins = savanna.plugins.list() plugins = sahara.plugins.list()
plugin_choices = [(plugin.name, plugin.title) for plugin in plugins] plugin_choices = [(plugin.name, plugin.title) for plugin in plugins]
self.fields["plugin_name"] = forms.ChoiceField( self.fields["plugin_name"] = forms.ChoiceField(