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:
parent
7be61a0331
commit
35c82af8be
@ -17,9 +17,9 @@ from saharadashboard.utils import workflow_helpers as work_helpers
|
||||
|
||||
|
||||
class Helpers(object):
|
||||
def __init__(self, savanna_client):
|
||||
self.savanna = savanna_client
|
||||
self.plugins = self.savanna.plugins
|
||||
def __init__(self, sahara_client):
|
||||
self.sahara = sahara_client
|
||||
self.plugins = self.sahara.plugins
|
||||
|
||||
def _get_node_processes(self, plugin):
|
||||
processes = []
|
||||
|
@ -17,7 +17,7 @@ from django.utils.translation import ugettext_lazy as _
|
||||
from horizon import forms
|
||||
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 savannaclient.api import base as api_base
|
||||
|
||||
@ -30,8 +30,8 @@ class UploadFileForm(forms.SelfHandlingForm,
|
||||
def __init__(self, request, *args, **kwargs):
|
||||
super(UploadFileForm, self).__init__(request, *args, **kwargs)
|
||||
|
||||
savanna = savannaclient.client(request)
|
||||
self._generate_plugin_version_fields(savanna)
|
||||
sahara = saharaclient.client(request)
|
||||
self._generate_plugin_version_fields(sahara)
|
||||
|
||||
self.fields['template_file'] = forms.FileField(label=_("Template"),
|
||||
required=True)
|
||||
@ -44,8 +44,8 @@ class UploadFileForm(forms.SelfHandlingForm,
|
||||
plugin_name = data['plugin_name']
|
||||
hadoop_version = data.get(plugin_name + "_version")
|
||||
|
||||
savanna = savannaclient.client(request)
|
||||
savanna.plugins.convert_to_cluster_template(plugin_name,
|
||||
sahara = saharaclient.client(request)
|
||||
sahara.plugins.convert_to_cluster_template(plugin_name,
|
||||
hadoop_version,
|
||||
data['template_name'],
|
||||
filecontent)
|
||||
|
@ -22,7 +22,7 @@ from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from horizon import tables
|
||||
|
||||
from saharadashboard.api.client import client as savannaclient
|
||||
from saharadashboard.api.client import client as saharaclient
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
@ -76,8 +76,8 @@ class DeleteTemplate(tables.BatchAction):
|
||||
return True
|
||||
|
||||
def action(self, request, template_id):
|
||||
savanna = savannaclient(request)
|
||||
savanna.cluster_templates.delete(template_id)
|
||||
sahara = saharaclient(request)
|
||||
sahara.cluster_templates.delete(template_id)
|
||||
|
||||
|
||||
class CreateClusterTemplate(tables.LinkAction):
|
||||
|
@ -19,7 +19,7 @@ from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
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 workflow_helpers as helpers
|
||||
nova = importutils.import_any('openstack_dashboard.api.nova',
|
||||
@ -35,8 +35,8 @@ class GeneralTab(tabs.Tab):
|
||||
|
||||
def get_context_data(self, request):
|
||||
template_id = self.tab_group.kwargs['template_id']
|
||||
savanna = savannaclient(request)
|
||||
template = savanna.cluster_templates.get(template_id)
|
||||
sahara = saharaclient(request)
|
||||
template = sahara.cluster_templates.get(template_id)
|
||||
return {"template": template}
|
||||
|
||||
|
||||
@ -47,14 +47,14 @@ class NodeGroupsTab(tabs.Tab):
|
||||
|
||||
def get_context_data(self, request):
|
||||
template_id = self.tab_group.kwargs['template_id']
|
||||
savanna = savannaclient(request)
|
||||
template = savanna.cluster_templates.get(template_id)
|
||||
sahara = saharaclient(request)
|
||||
template = sahara.cluster_templates.get(template_id)
|
||||
for ng in template.node_groups:
|
||||
if not ng["flavor_id"]:
|
||||
continue
|
||||
ng["flavor_name"] = nova.flavor_get(request, ng["flavor_id"]).name
|
||||
ng["node_group_template"] = helpers.safe_call(
|
||||
savanna.node_group_templates.get,
|
||||
sahara.node_group_templates.get,
|
||||
ng.get("node_group_template_id", None))
|
||||
return {"template": template}
|
||||
|
||||
|
@ -21,7 +21,7 @@ from horizon import tables
|
||||
from horizon import tabs
|
||||
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.tables import ClusterTemplatesTable
|
||||
import saharadashboard.cluster_templates.tabs as _tabs
|
||||
@ -36,8 +36,8 @@ class ClusterTemplatesView(tables.DataTableView):
|
||||
template_name = 'cluster_templates/cluster_templates.html'
|
||||
|
||||
def get_data(self):
|
||||
savanna = savannaclient(self.request)
|
||||
cluster_templates = savanna.cluster_templates.list()
|
||||
sahara = saharaclient(self.request)
|
||||
cluster_templates = sahara.cluster_templates.list()
|
||||
return cluster_templates
|
||||
|
||||
|
||||
@ -89,8 +89,8 @@ class CopyClusterTemplateView(workflows.WorkflowView):
|
||||
def get_object(self, *args, **kwargs):
|
||||
if not hasattr(self, "_object"):
|
||||
template_id = self.kwargs['template_id']
|
||||
savanna = savannaclient(self.request)
|
||||
template = savanna.cluster_templates.get(template_id)
|
||||
sahara = saharaclient(self.request)
|
||||
template = sahara.cluster_templates.get(template_id)
|
||||
self._object = template
|
||||
return self._object
|
||||
|
||||
|
@ -17,7 +17,7 @@ import logging
|
||||
|
||||
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
|
||||
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")
|
||||
|
||||
def __init__(self, request, context_seed, entry_point, *args, **kwargs):
|
||||
savanna = savannaclient(request)
|
||||
sahara = saharaclient(request)
|
||||
|
||||
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)
|
||||
|
||||
request.GET = request.GET.copy()
|
||||
|
@ -22,7 +22,7 @@ from horizon import exceptions
|
||||
from horizon import forms
|
||||
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.utils import anti_affinity as aa
|
||||
import saharadashboard.utils.workflow_helpers as whelpers
|
||||
@ -39,8 +39,8 @@ class SelectPluginAction(workflows.Action):
|
||||
def __init__(self, request, *args, **kwargs):
|
||||
super(SelectPluginAction, self).__init__(request, *args, **kwargs)
|
||||
|
||||
savanna = savannaclient.client(request)
|
||||
plugins = savanna.plugins.list()
|
||||
sahara = saharaclient.client(request)
|
||||
plugins = sahara.plugins.list()
|
||||
plugin_choices = [(plugin.name, plugin.title) for plugin in plugins]
|
||||
|
||||
self.fields["plugin_name"] = forms.ChoiceField(
|
||||
@ -162,12 +162,12 @@ class ConfigureNodegroupsAction(workflows.Action):
|
||||
super(ConfigureNodegroupsAction, self). \
|
||||
__init__(request, *args, **kwargs)
|
||||
|
||||
savanna = savannaclient.client(request)
|
||||
sahara = saharaclient.client(request)
|
||||
|
||||
plugin, hadoop_version = whelpers.\
|
||||
get_plugin_and_hadoop_version(request)
|
||||
|
||||
self.templates = savanna.node_group_templates.find(
|
||||
self.templates = sahara.node_group_templates.find(
|
||||
plugin_name=plugin,
|
||||
hadoop_version=hadoop_version)
|
||||
|
||||
@ -227,8 +227,8 @@ class ConfigureClusterTemplate(whelpers.ServiceParametersWorkflow,
|
||||
def __init__(self, request, context_seed, entry_point, *args, **kwargs):
|
||||
ConfigureClusterTemplate._cls_registry = set([])
|
||||
|
||||
savanna = savannaclient.client(request)
|
||||
hlps = helpers.Helpers(savanna)
|
||||
sahara = saharaclient.client(request)
|
||||
hlps = helpers.Helpers(sahara)
|
||||
|
||||
plugin, hadoop_version = whelpers.\
|
||||
get_plugin_and_hadoop_version(request)
|
||||
@ -263,7 +263,7 @@ class ConfigureClusterTemplate(whelpers.ServiceParametersWorkflow,
|
||||
|
||||
def handle(self, request, context):
|
||||
try:
|
||||
savanna = savannaclient.client(request)
|
||||
sahara = saharaclient.client(request)
|
||||
node_groups = []
|
||||
configs_dict = whelpers.parse_configs_from_context(context,
|
||||
self.defaults)
|
||||
@ -283,7 +283,7 @@ class ConfigureClusterTemplate(whelpers.ServiceParametersWorkflow,
|
||||
get_plugin_and_hadoop_version(request)
|
||||
|
||||
#TODO(nkonovalov): Fix client to support default_image_id
|
||||
savanna.cluster_templates.create(
|
||||
sahara.cluster_templates.create(
|
||||
context["general_cluster_template_name"],
|
||||
plugin,
|
||||
hadoop_version,
|
||||
|
@ -18,7 +18,7 @@ import logging
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from horizon import tables
|
||||
|
||||
from saharadashboard.api.client import client as savannaclient
|
||||
from saharadashboard.api.client import client as saharaclient
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
@ -50,16 +50,16 @@ class DeleteCluster(tables.BatchAction):
|
||||
classes = ('btn-danger', 'btn-terminate')
|
||||
|
||||
def action(self, request, obj_id):
|
||||
savanna = savannaclient(request)
|
||||
savanna.clusters.delete(obj_id)
|
||||
sahara = saharaclient(request)
|
||||
sahara.clusters.delete(obj_id)
|
||||
|
||||
|
||||
class UpdateRow(tables.Row):
|
||||
ajax = True
|
||||
|
||||
def get_data(self, request, instance_id):
|
||||
savanna = savannaclient(request)
|
||||
instance = savanna.clusters.get(instance_id)
|
||||
sahara = saharaclient(request)
|
||||
instance = sahara.clusters.get(instance_id)
|
||||
return instance
|
||||
|
||||
|
||||
|
@ -33,7 +33,7 @@ glance = importutils.import_any('openstack_dashboard.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__)
|
||||
|
||||
@ -45,8 +45,8 @@ class GeneralTab(tabs.Tab):
|
||||
|
||||
def get_context_data(self, request):
|
||||
cluster_id = self.tab_group.kwargs['cluster_id']
|
||||
savanna = savannaclient(request)
|
||||
cluster = savanna.clusters.get(cluster_id)
|
||||
sahara = saharaclient(request)
|
||||
cluster = sahara.clusters.get(cluster_id)
|
||||
|
||||
for info_key, info_val in cluster.info.items():
|
||||
for key, val in info_val.items():
|
||||
@ -57,7 +57,7 @@ class GeneralTab(tabs.Tab):
|
||||
cluster.default_image_id)
|
||||
|
||||
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)
|
||||
else:
|
||||
cluster_template = None
|
||||
@ -87,14 +87,14 @@ class NodeGroupsTab(tabs.Tab):
|
||||
|
||||
def get_context_data(self, request):
|
||||
cluster_id = self.tab_group.kwargs['cluster_id']
|
||||
savanna = savannaclient(request)
|
||||
cluster = savanna.clusters.get(cluster_id)
|
||||
sahara = saharaclient(request)
|
||||
cluster = sahara.clusters.get(cluster_id)
|
||||
for ng in cluster.node_groups:
|
||||
if not ng["flavor_id"]:
|
||||
continue
|
||||
ng["flavor_name"] = nova.flavor_get(request, ng["flavor_id"]).name
|
||||
ng["node_group_template"] = helpers.safe_call(
|
||||
savanna.node_group_templates.get,
|
||||
sahara.node_group_templates.get,
|
||||
ng.get("node_group_template_id", None))
|
||||
|
||||
return {"cluster": cluster}
|
||||
@ -135,8 +135,8 @@ class InstancesTab(tabs.TableTab):
|
||||
|
||||
def get_cluster_instances_data(self):
|
||||
cluster_id = self.tab_group.kwargs['cluster_id']
|
||||
savanna = savannaclient(self.request)
|
||||
cluster = savanna.clusters.get(cluster_id)
|
||||
sahara = saharaclient(self.request)
|
||||
cluster = sahara.clusters.get(cluster_id)
|
||||
|
||||
instances = []
|
||||
for ng in cluster.node_groups:
|
||||
|
@ -19,7 +19,7 @@ from horizon import tables
|
||||
from horizon import tabs
|
||||
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
|
||||
import saharadashboard.clusters.tabs as _tabs
|
||||
@ -34,8 +34,8 @@ class ClustersView(tables.DataTableView):
|
||||
template_name = 'clusters/clusters.html'
|
||||
|
||||
def get_data(self):
|
||||
savanna = savannaclient(self.request)
|
||||
clusters = savanna.clusters.list()
|
||||
sahara = saharaclient(self.request)
|
||||
clusters = sahara.clusters.list()
|
||||
return clusters
|
||||
|
||||
|
||||
@ -82,8 +82,8 @@ class ScaleClusterView(workflows.WorkflowView):
|
||||
def get_object(self, *args, **kwargs):
|
||||
if not hasattr(self, "_object"):
|
||||
template_id = self.kwargs['cluster_id']
|
||||
savanna = savannaclient(self.request)
|
||||
template = savanna.cluster_templates.get(template_id)
|
||||
sahara = saharaclient(self.request)
|
||||
template = sahara.cluster_templates.get(template_id)
|
||||
self._object = template
|
||||
return self._object
|
||||
|
||||
|
@ -31,7 +31,7 @@ nova = importutils.import_any('openstack_dashboard.api.nova',
|
||||
|
||||
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
|
||||
import saharadashboard.cluster_templates.workflows.create as t_flows
|
||||
from savannaclient.api import base as api_base
|
||||
@ -108,13 +108,13 @@ class GeneralConfigAction(workflows.Action):
|
||||
)
|
||||
|
||||
def populate_image_choices(self, request, context):
|
||||
savanna = savannaclient.client(request)
|
||||
all_images = savanna.images.list()
|
||||
sahara = saharaclient.client(request)
|
||||
all_images = sahara.images.list()
|
||||
|
||||
plugin, hadoop_version = whelpers.\
|
||||
get_plugin_and_hadoop_version(request)
|
||||
|
||||
details = savanna.plugins.get_version_details(plugin,
|
||||
details = sahara.plugins.get_version_details(plugin,
|
||||
hadoop_version)
|
||||
|
||||
return [(image.id, image.name) for image in all_images
|
||||
@ -127,8 +127,8 @@ class GeneralConfigAction(workflows.Action):
|
||||
return keypair_list
|
||||
|
||||
def populate_cluster_template_choices(self, request, context):
|
||||
savanna = savannaclient.client(request)
|
||||
templates = savanna.cluster_templates.list()
|
||||
sahara = saharaclient.client(request)
|
||||
templates = sahara.cluster_templates.list()
|
||||
|
||||
plugin, hadoop_version = whelpers.\
|
||||
get_plugin_and_hadoop_version(request)
|
||||
@ -194,7 +194,7 @@ class ConfigureCluster(whelpers.StatusFormatMixin, workflows.Workflow):
|
||||
|
||||
def handle(self, request, context):
|
||||
try:
|
||||
savanna = savannaclient.client(request)
|
||||
sahara = saharaclient.client(request)
|
||||
#TODO(nkonovalov) Implement AJAX Node Groups
|
||||
node_groups = None
|
||||
|
||||
@ -204,7 +204,7 @@ class ConfigureCluster(whelpers.StatusFormatMixin, workflows.Workflow):
|
||||
cluster_template_id = context["general_cluster_template"] or None
|
||||
user_keypair = context["general_keypair"] or None
|
||||
|
||||
savanna.clusters.create(
|
||||
sahara.clusters.create(
|
||||
context["general_cluster_name"],
|
||||
plugin, hadoop_version,
|
||||
cluster_template_id=cluster_template_id,
|
||||
|
@ -19,7 +19,7 @@ import logging
|
||||
from django.utils.translation import ugettext as _
|
||||
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
|
||||
|
||||
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):
|
||||
ScaleCluster._cls_registry = set([])
|
||||
|
||||
savanna = savannaclient.client(request)
|
||||
sahara = saharaclient.client(request)
|
||||
|
||||
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" \
|
||||
% cluster.name
|
||||
@ -108,9 +108,9 @@ class ScaleCluster(cl_create_flow.ConfigureCluster,
|
||||
return self.success_message
|
||||
|
||||
def handle(self, request, context):
|
||||
savanna = savannaclient.client(request)
|
||||
sahara = saharaclient.client(request)
|
||||
cluster_id = request.GET["cluster_id"]
|
||||
cluster = savanna.clusters.get(cluster_id)
|
||||
cluster = sahara.clusters.get(cluster_id)
|
||||
|
||||
existing_node_groups = set([])
|
||||
for ng in cluster.node_groups:
|
||||
@ -149,7 +149,7 @@ class ScaleCluster(cl_create_flow.ConfigureCluster,
|
||||
"count": int(count)}
|
||||
)
|
||||
try:
|
||||
savanna.clusters.scale(cluster_id, scale_object)
|
||||
sahara.clusters.scale(cluster_id, scale_object)
|
||||
return True
|
||||
except api_base.APIException as e:
|
||||
self.error_description = str(e)
|
||||
|
@ -19,7 +19,7 @@ from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from horizon import tables
|
||||
|
||||
from saharadashboard.api.client import client as savannaclient
|
||||
from saharadashboard.api.client import client as saharaclient
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
@ -40,8 +40,8 @@ class DeleteDataSource(tables.BatchAction):
|
||||
classes = ('btn-danger', 'btn-terminate')
|
||||
|
||||
def action(self, request, obj_id):
|
||||
savanna = savannaclient(request)
|
||||
savanna.data_sources.delete(obj_id)
|
||||
sahara = saharaclient(request)
|
||||
sahara.data_sources.delete(obj_id)
|
||||
|
||||
|
||||
class DataSourcesTable(tables.DataTable):
|
||||
|
@ -19,7 +19,7 @@ from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from horizon import tabs
|
||||
|
||||
from saharadashboard.api.client import client as savannaclient
|
||||
from saharadashboard.api.client import client as saharaclient
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
@ -31,8 +31,8 @@ class GeneralTab(tabs.Tab):
|
||||
|
||||
def get_context_data(self, request):
|
||||
data_source_id = self.tab_group.kwargs['data_source_id']
|
||||
savanna = savannaclient(request)
|
||||
data_source = savanna.data_sources.get(data_source_id)
|
||||
sahara = saharaclient(request)
|
||||
data_source = sahara.data_sources.get(data_source_id)
|
||||
return {"data_source": data_source}
|
||||
|
||||
|
||||
|
@ -19,7 +19,7 @@ from horizon import tables
|
||||
from horizon import tabs
|
||||
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
|
||||
import saharadashboard.data_sources.tabs as _tabs
|
||||
@ -33,8 +33,8 @@ class DataSourcesView(tables.DataTableView):
|
||||
template_name = 'data_sources/data_sources.html'
|
||||
|
||||
def get_data(self):
|
||||
savanna = savannaclient(self.request)
|
||||
data_sources = savanna.data_sources.list()
|
||||
sahara = saharaclient(self.request)
|
||||
data_sources = sahara.data_sources.list()
|
||||
return data_sources
|
||||
|
||||
|
||||
|
@ -24,7 +24,7 @@ from django.utils.translation import ugettext as _
|
||||
from horizon import forms
|
||||
from horizon import workflows
|
||||
|
||||
from saharadashboard.api.client import client as savannaclient
|
||||
from saharadashboard.api.client import client as saharaclient
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
@ -111,8 +111,8 @@ class CreateDataSource(workflows.Workflow):
|
||||
default_steps = (GeneralConfig, )
|
||||
|
||||
def handle(self, request, context):
|
||||
savanna = savannaclient(request)
|
||||
savanna.data_sources.create(
|
||||
sahara = saharaclient(request)
|
||||
sahara.data_sources.create(
|
||||
context["general_data_source_name"],
|
||||
context["general_data_source_description"],
|
||||
context["general_data_source_type"],
|
||||
|
@ -20,7 +20,7 @@ from horizon import exceptions
|
||||
from horizon import forms
|
||||
from horizon import messages
|
||||
|
||||
from saharadashboard.api import client as savannaclient
|
||||
from saharadashboard.api import client as saharaclient
|
||||
from saharadashboard.utils import importutils
|
||||
from savannaclient.api import base as api_base
|
||||
|
||||
@ -41,15 +41,15 @@ class ImageForm(forms.SelfHandlingForm):
|
||||
|
||||
def handle(self, request, data):
|
||||
try:
|
||||
savanna = savannaclient.client(request)
|
||||
sahara = saharaclient.client(request)
|
||||
|
||||
image_id = data['image_id']
|
||||
user_name = data['user_name']
|
||||
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"])
|
||||
savanna.images.update_tags(image_id, image_tags)
|
||||
sahara.images.update_tags(image_id, image_tags)
|
||||
|
||||
messages.success(request, self.message)
|
||||
|
||||
@ -114,8 +114,8 @@ class RegisterImageForm(ImageForm):
|
||||
|
||||
final_images = []
|
||||
|
||||
savanna = savannaclient.client(request)
|
||||
image_ids = [img.id for img in savanna.images.list()]
|
||||
sahara = saharaclient.client(request)
|
||||
image_ids = [img.id for img in sahara.images.list()]
|
||||
|
||||
for image in images:
|
||||
if image.id not in image_ids:
|
||||
|
@ -20,7 +20,7 @@ from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
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
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
@ -55,8 +55,8 @@ class UnregisterImages(tables.BatchAction):
|
||||
classes = ('btn-danger', 'btn-terminate')
|
||||
|
||||
def action(self, request, obj_id):
|
||||
savanna = savannaclient(request)
|
||||
savanna.images.unregister_image(obj_id)
|
||||
sahara = saharaclient(request)
|
||||
sahara.images.unregister_image(obj_id)
|
||||
|
||||
|
||||
class ImageRegistryTable(tables.DataTable):
|
||||
|
@ -20,7 +20,7 @@ from django.core.urlresolvers import reverse_lazy
|
||||
from horizon import forms
|
||||
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 RegisterImageForm
|
||||
from saharadashboard.image_registry.tables import ImageRegistryTable
|
||||
@ -34,21 +34,21 @@ class ImageRegistryView(tables.DataTableView):
|
||||
template_name = 'image_registry/image_registry.html'
|
||||
|
||||
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):
|
||||
savanna = savannaclient(request)
|
||||
plugins = savanna.plugins.list()
|
||||
sahara = saharaclient(request)
|
||||
plugins = sahara.plugins.list()
|
||||
|
||||
plugins_object = dict()
|
||||
for plugin in plugins:
|
||||
plugins_object[plugin.name] = dict()
|
||||
for version in plugin.versions:
|
||||
plugins_object[plugin.name][version] = []
|
||||
details = savanna.plugins.get_version_details(plugin.name,
|
||||
details = sahara.plugins.get_version_details(plugin.name,
|
||||
version)
|
||||
|
||||
for tag in details.required_image_tags:
|
||||
@ -70,8 +70,8 @@ class EditTagsView(forms.ModalFormView):
|
||||
return context
|
||||
|
||||
def get_object(self):
|
||||
savanna = savannaclient(self.request)
|
||||
return savanna.images.get(self.kwargs["image_id"])
|
||||
sahara = saharaclient(self.request)
|
||||
return sahara.images.get(self.kwargs["image_id"])
|
||||
|
||||
def get_initial(self):
|
||||
image = self.get_object()
|
||||
|
@ -28,7 +28,7 @@ from django.utils.translation import ugettext as _
|
||||
from horizon import forms
|
||||
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
|
||||
|
||||
import uuid
|
||||
@ -59,7 +59,7 @@ class JobBinaryCreateForm(forms.SelfHandlingForm):
|
||||
job_binary_url = forms.CharField(label=_("URL"),
|
||||
required=False,
|
||||
widget=LabeledInput())
|
||||
job_binary_savanna_internal = forms.ChoiceField(label=_("Internal binary"),
|
||||
job_binary_internal = forms.ChoiceField(label=_("Internal binary"),
|
||||
required=False)
|
||||
|
||||
job_binary_file = forms.FileField(label=_("Upload File"),
|
||||
@ -93,12 +93,12 @@ class JobBinaryCreateForm(forms.SelfHandlingForm):
|
||||
[("savanna-db", "Internal database"),
|
||||
("swift", "Swift")]
|
||||
|
||||
self.fields["job_binary_savanna_internal"].choices =\
|
||||
self.populate_job_binary_savanna_internal_choices(request)
|
||||
self.fields["job_binary_internal"].choices =\
|
||||
self.populate_job_binary_internal_choices(request)
|
||||
|
||||
def populate_job_binary_savanna_internal_choices(self, request):
|
||||
savanna = savannaclient.client(request)
|
||||
job_binaries = savanna.job_binary_internals.list()
|
||||
def populate_job_binary_internal_choices(self, request):
|
||||
sahara = saharaclient.client(request)
|
||||
job_binaries = sahara.job_binary_internals.list()
|
||||
|
||||
choices = [(job_binary.id, job_binary.name)
|
||||
for job_binary in job_binaries]
|
||||
@ -109,16 +109,16 @@ class JobBinaryCreateForm(forms.SelfHandlingForm):
|
||||
|
||||
def handle(self, request, context):
|
||||
try:
|
||||
savanna = savannaclient.client(request)
|
||||
sahara = saharaclient.client(request)
|
||||
extra = {}
|
||||
bin_url = "%s://%s" % (context["job_binary_type"],
|
||||
context["job_binary_url"])
|
||||
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"):
|
||||
extra = self.handle_swift(request, context)
|
||||
|
||||
savanna.job_binaries.create(
|
||||
sahara.job_binaries.create(
|
||||
context["job_binary_name"],
|
||||
bin_url,
|
||||
context["job_binary_description"],
|
||||
@ -148,18 +148,18 @@ class JobBinaryCreateForm(forms.SelfHandlingForm):
|
||||
help_text_template = \
|
||||
("job_binaries/_create_job_binary_help.html")
|
||||
|
||||
def handle_savanna(self, request, context):
|
||||
def handle_internal(self, request, context):
|
||||
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):
|
||||
result = savanna.job_binary_internals.create(
|
||||
result = sahara.job_binary_internals.create(
|
||||
self.get_unique_binary_name(
|
||||
request, request.FILES["job_binary_file"].name),
|
||||
request.FILES["job_binary_file"].read())
|
||||
elif(bin_id == self.NEW_SCRIPT):
|
||||
result = savanna.job_binary_internals.create(
|
||||
result = sahara.job_binary_internals.create(
|
||||
self.get_unique_binary_name(
|
||||
request, context["job_binary_script_name"]),
|
||||
context["job_binary_script"])
|
||||
@ -178,8 +178,8 @@ class JobBinaryCreateForm(forms.SelfHandlingForm):
|
||||
return extra
|
||||
|
||||
def get_unique_binary_name(self, request, base_name):
|
||||
savanna = savannaclient.client(request)
|
||||
internals = savanna.job_binary_internals.list()
|
||||
sahara = saharaclient.client(request)
|
||||
internals = sahara.job_binary_internals.list()
|
||||
names = [internal.name for internal in internals]
|
||||
if base_name in names:
|
||||
return "%s_%s" % (base_name, uuid.uuid1())
|
||||
|
@ -19,7 +19,7 @@ from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
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
|
||||
|
||||
|
||||
@ -42,18 +42,18 @@ class DeleteJobBinary(tables.BatchAction):
|
||||
classes = ('btn-danger', 'btn-terminate')
|
||||
|
||||
def action(self, request, obj_id):
|
||||
savanna = savannaclient.client(request)
|
||||
jb = savanna.job_binaries.get(obj_id)
|
||||
sahara = saharaclient.client(request)
|
||||
jb = sahara.job_binaries.get(obj_id)
|
||||
(jb_type, jb_internal_id) = jb.url.split("://")
|
||||
if jb_type == "savanna-db":
|
||||
try:
|
||||
savanna.job_binary_internals.delete(jb_internal_id)
|
||||
sahara.job_binary_internals.delete(jb_internal_id)
|
||||
except api_base.APIException:
|
||||
# nothing to do for job-binary-internal if
|
||||
# it does not exist.
|
||||
pass
|
||||
|
||||
savanna.job_binaries.delete(obj_id)
|
||||
sahara.job_binaries.delete(obj_id)
|
||||
|
||||
|
||||
class DownloadJobBinary(tables.LinkAction):
|
||||
|
@ -19,7 +19,7 @@ from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from horizon import tabs
|
||||
|
||||
from saharadashboard.api.client import client as savannaclient
|
||||
from saharadashboard.api.client import client as saharaclient
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
@ -31,8 +31,8 @@ class GeneralTab(tabs.Tab):
|
||||
|
||||
def get_context_data(self, request):
|
||||
job_binary_id = self.tab_group.kwargs['job_binary_id']
|
||||
savanna = savannaclient(request)
|
||||
job_binary = savanna.job_binaries.get(job_binary_id)
|
||||
sahara = saharaclient(request)
|
||||
job_binary = sahara.job_binaries.get(job_binary_id)
|
||||
return {"job_binary": job_binary}
|
||||
|
||||
|
||||
|
@ -27,7 +27,7 @@ from horizon import forms
|
||||
from horizon import tables
|
||||
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
|
||||
from saharadashboard.job_binaries.tables import JobBinariesTable
|
||||
@ -42,8 +42,8 @@ class JobBinariesView(tables.DataTableView):
|
||||
template_name = 'job_binaries/job_binaries.html'
|
||||
|
||||
def get_data(self):
|
||||
savanna = savannaclient(self.request)
|
||||
job_binaries = savanna.job_binaries.list()
|
||||
sahara = saharaclient(self.request)
|
||||
job_binaries = sahara.job_binaries.list()
|
||||
return job_binaries
|
||||
|
||||
|
||||
@ -70,9 +70,9 @@ class JobBinaryDetailsView(tabs.TabView):
|
||||
class DownloadJobBinaryView(View):
|
||||
def get(self, request, job_binary_id=None):
|
||||
try:
|
||||
savanna = savannaclient(request)
|
||||
jb = savanna.job_binaries.get(job_binary_id)
|
||||
data = savanna.job_binaries.get_file(job_binary_id)
|
||||
sahara = saharaclient(request)
|
||||
jb = sahara.job_binaries.get(job_binary_id)
|
||||
data = sahara.job_binaries.get_file(job_binary_id)
|
||||
except Exception:
|
||||
redirect = reverse('horizon:sahara:job_binaries:index')
|
||||
exceptions.handle(self.request,
|
||||
|
@ -21,7 +21,7 @@ from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
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
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
@ -36,8 +36,8 @@ class DeleteJobExecution(tables.BatchAction):
|
||||
classes = ('btn-danger', 'btn-terminate')
|
||||
|
||||
def action(self, request, obj_id):
|
||||
savanna = savannaclient(request)
|
||||
savanna.job_executions.delete(obj_id)
|
||||
sahara = saharaclient(request)
|
||||
sahara.job_executions.delete(obj_id)
|
||||
|
||||
|
||||
class ReLaunchJobExistingCluster(j_t.ChoosePlugin):
|
||||
@ -73,8 +73,8 @@ class UpdateRow(tables.Row):
|
||||
ajax = True
|
||||
|
||||
def get_data(self, request, job_execution_id):
|
||||
savanna = savannaclient(request)
|
||||
job_execution = savanna.job_executions.get(job_execution_id)
|
||||
sahara = saharaclient(request)
|
||||
job_execution = sahara.job_executions.get(job_execution_id)
|
||||
return job_execution
|
||||
|
||||
|
||||
|
@ -19,7 +19,7 @@ from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from horizon import tabs
|
||||
|
||||
from saharadashboard.api.client import client as savannaclient
|
||||
from saharadashboard.api.client import client as saharaclient
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
@ -31,9 +31,9 @@ class GeneralTab(tabs.Tab):
|
||||
|
||||
def get_context_data(self, request):
|
||||
job_execution_id = self.tab_group.kwargs['job_execution_id']
|
||||
savanna = savannaclient(request)
|
||||
job_execution = savanna.job_executions.get(job_execution_id)
|
||||
object_names = self.get_object_names(job_execution, savanna)
|
||||
sahara = saharaclient(request)
|
||||
job_execution = sahara.job_executions.get(job_execution_id)
|
||||
object_names = self.get_object_names(job_execution, sahara)
|
||||
|
||||
return {"job_execution": job_execution,
|
||||
"object_names": object_names}
|
||||
@ -56,15 +56,15 @@ class GeneralTab(tabs.Tab):
|
||||
|
||||
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
|
||||
try:
|
||||
s_obj = getattr(s_client, savanna_obj)
|
||||
s_obj = getattr(s_client, sahara_obj)
|
||||
obj = s_obj.get(obj_id)
|
||||
object_name = obj.name
|
||||
except Exception as e:
|
||||
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
|
||||
|
||||
|
||||
|
@ -18,7 +18,7 @@ import logging
|
||||
from horizon import tables
|
||||
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
|
||||
import saharadashboard.job_executions.tabs as _tabs
|
||||
@ -31,8 +31,8 @@ class JobExecutionsView(tables.DataTableView):
|
||||
template_name = 'job_executions/job_executions.html'
|
||||
|
||||
def get_data(self):
|
||||
savanna = savannaclient(self.request)
|
||||
jobs = savanna.job_executions.list()
|
||||
sahara = saharaclient(self.request)
|
||||
jobs = sahara.job_executions.list()
|
||||
return jobs
|
||||
|
||||
|
||||
|
@ -21,7 +21,7 @@ from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from horizon import tables
|
||||
|
||||
from saharadashboard.api.client import client as savannaclient
|
||||
from saharadashboard.api.client import client as saharaclient
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
@ -42,8 +42,8 @@ class DeleteJob(tables.BatchAction):
|
||||
classes = ('btn-danger', 'btn-terminate')
|
||||
|
||||
def action(self, request, obj_id):
|
||||
savanna = savannaclient(request)
|
||||
savanna.jobs.delete(obj_id)
|
||||
sahara = saharaclient(request)
|
||||
sahara.jobs.delete(obj_id)
|
||||
|
||||
|
||||
class LaunchJobExistingCluster(tables.LinkAction):
|
||||
|
@ -19,7 +19,7 @@ from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from horizon import tabs
|
||||
|
||||
from saharadashboard.api.client import client as savannaclient
|
||||
from saharadashboard.api.client import client as saharaclient
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
@ -31,8 +31,8 @@ class GeneralTab(tabs.Tab):
|
||||
|
||||
def get_context_data(self, request):
|
||||
job_id = self.tab_group.kwargs['job_id']
|
||||
savanna = savannaclient(request)
|
||||
job = savanna.jobs.get(job_id)
|
||||
sahara = saharaclient(request)
|
||||
job = sahara.jobs.get(job_id)
|
||||
return {"job": job}
|
||||
|
||||
|
||||
|
@ -21,7 +21,7 @@ from horizon import tables
|
||||
from horizon import tabs
|
||||
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.tabs as _tabs
|
||||
@ -36,8 +36,8 @@ class JobsView(tables.DataTableView):
|
||||
template_name = 'jobs/jobs.html'
|
||||
|
||||
def get_data(self):
|
||||
savanna = savannaclient(self.request)
|
||||
jobs = savanna.jobs.list()
|
||||
sahara = saharaclient(self.request)
|
||||
jobs = sahara.jobs.list()
|
||||
return jobs
|
||||
|
||||
|
||||
@ -70,8 +70,8 @@ class LaunchJobView(workflows.WorkflowView):
|
||||
if request.is_ajax():
|
||||
if request.REQUEST.get("json", None):
|
||||
job_id = request.REQUEST.get("job_id")
|
||||
savanna = savannaclient(request)
|
||||
job_type = savanna.jobs.get(job_id).type
|
||||
sahara = saharaclient(request)
|
||||
job_type = sahara.jobs.get(job_id).type
|
||||
return HttpResponse(json.dumps({"job_type": job_type}),
|
||||
mimetype='application/json')
|
||||
return super(LaunchJobView, self).get(request, args, kwargs)
|
||||
|
@ -21,7 +21,7 @@ from django.utils.translation import ugettext as _
|
||||
from horizon import forms
|
||||
from horizon import workflows
|
||||
|
||||
from saharadashboard.api.client import client as savannaclient
|
||||
from saharadashboard.api.client import client as saharaclient
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
@ -37,8 +37,8 @@ class AdditionalLibsAction(workflows.Action):
|
||||
widget=forms.HiddenInput())
|
||||
|
||||
def populate_lib_binaries_choices(self, request, context):
|
||||
savanna = savannaclient(request)
|
||||
job_binaries = savanna.job_binaries.list()
|
||||
sahara = saharaclient(request)
|
||||
job_binaries = sahara.job_binaries.list()
|
||||
|
||||
choices = [(job_binary.id, job_binary.name)
|
||||
for job_binary in job_binaries]
|
||||
@ -77,8 +77,8 @@ class GeneralConfigAction(workflows.Action):
|
||||
return choices
|
||||
|
||||
def populate_main_binary_choices(self, request, context):
|
||||
savanna = savannaclient(request)
|
||||
job_binaries = savanna.job_binaries.list()
|
||||
sahara = saharaclient(request)
|
||||
job_binaries = sahara.job_binaries.list()
|
||||
|
||||
choices = [(job_binary.id, job_binary.name)
|
||||
for job_binary in job_binaries]
|
||||
@ -125,7 +125,7 @@ class CreateJob(workflows.Workflow):
|
||||
default_steps = (GeneralConfig, ConfigureLibs)
|
||||
|
||||
def handle(self, request, context):
|
||||
savanna = savannaclient(request)
|
||||
sahara = saharaclient(request)
|
||||
main_locations = []
|
||||
lib_locations = []
|
||||
|
||||
@ -136,7 +136,7 @@ class CreateJob(workflows.Workflow):
|
||||
if context.get("main_binary", None):
|
||||
main_locations.append(context["main_binary"])
|
||||
|
||||
savanna.jobs.create(
|
||||
sahara.jobs.create(
|
||||
context["job_name"],
|
||||
context["job_type"],
|
||||
main_locations,
|
||||
|
@ -21,7 +21,7 @@ from django.utils.translation import ugettext as _
|
||||
from horizon import forms
|
||||
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.clusters.workflows.create as c_flow
|
||||
import saharadashboard.utils.workflow_helpers as whelpers
|
||||
@ -75,8 +75,8 @@ class JobExecutionGeneralConfigAction(workflows.Action):
|
||||
return self.get_data_source_choices(request, context)
|
||||
|
||||
def get_data_source_choices(self, request, context):
|
||||
savanna = savannaclient(request)
|
||||
data_sources = savanna.data_sources.list()
|
||||
sahara = saharaclient(request)
|
||||
data_sources = sahara.data_sources.list()
|
||||
|
||||
choices = [(data_source.id, data_source.name)
|
||||
for data_source in data_sources]
|
||||
@ -85,8 +85,8 @@ class JobExecutionGeneralConfigAction(workflows.Action):
|
||||
return choices
|
||||
|
||||
def populate_job_choices(self, request):
|
||||
savanna = savannaclient(request)
|
||||
jobs = savanna.jobs.list()
|
||||
sahara = saharaclient(request)
|
||||
jobs = sahara.jobs.list()
|
||||
|
||||
choices = [(job.id, job.name)
|
||||
for job in jobs]
|
||||
@ -106,8 +106,8 @@ class JobExecutionExistingGeneralConfigAction(JobExecutionGeneralConfigAction):
|
||||
widget=forms.Select(attrs={"class": "cluster_choice"}))
|
||||
|
||||
def populate_cluster_choices(self, request, context):
|
||||
savanna = savannaclient(request)
|
||||
clusters = savanna.clusters.list()
|
||||
sahara = saharaclient(request)
|
||||
clusters = sahara.clusters.list()
|
||||
|
||||
choices = [(cluster.id, cluster.name)
|
||||
for cluster in clusters]
|
||||
@ -162,7 +162,7 @@ class JobConfigAction(workflows.Action):
|
||||
super(JobConfigAction, self).__init__(request, *args, **kwargs)
|
||||
job_ex_id = request.REQUEST.get("job_execution_id")
|
||||
if job_ex_id is not None:
|
||||
client = savannaclient(request)
|
||||
client = saharaclient(request)
|
||||
job_ex_id = request.REQUEST.get("job_execution_id")
|
||||
job_ex = client.job_executions.get(job_ex_id)
|
||||
job_configs = job_ex.job_configs
|
||||
@ -207,7 +207,7 @@ class JobConfigAction(workflows.Action):
|
||||
return cleaned_data
|
||||
|
||||
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_type = client.jobs.get(job_id).type
|
||||
job_configs = client.jobs.get_configs(job_type).job_config
|
||||
@ -332,9 +332,9 @@ class LaunchJob(workflows.Workflow):
|
||||
default_steps = (JobExecutionExistingGeneralConfig, JobConfig)
|
||||
|
||||
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_cluster"],
|
||||
context["job_general_job_input"],
|
||||
@ -378,7 +378,7 @@ class SelectHadoopPluginAction(t_flows.SelectPluginAction):
|
||||
widget=forms.HiddenInput(
|
||||
attrs={"class": "hidden_create_field"}))
|
||||
|
||||
client = savannaclient(request)
|
||||
client = saharaclient(request)
|
||||
job_ex_id = request.REQUEST.get("job_execution_id")
|
||||
job_configs = client.job_executions.get(job_ex_id).job_configs
|
||||
|
||||
@ -423,7 +423,7 @@ class LaunchJobNewCluster(workflows.Workflow):
|
||||
JobConfig)
|
||||
|
||||
def handle(self, request, context):
|
||||
savanna = savannaclient(request)
|
||||
sahara = saharaclient(request)
|
||||
node_groups = None
|
||||
|
||||
plugin, hadoop_version = (
|
||||
@ -432,7 +432,7 @@ class LaunchJobNewCluster(workflows.Workflow):
|
||||
ct_id = context["cluster_general_cluster_template"] or None
|
||||
user_keypair = context["cluster_general_keypair"] or None
|
||||
|
||||
cluster = savanna.clusters.create(
|
||||
cluster = sahara.clusters.create(
|
||||
context["cluster_general_cluster_name"],
|
||||
plugin, hadoop_version,
|
||||
cluster_template_id=ct_id,
|
||||
@ -444,7 +444,7 @@ class LaunchJobNewCluster(workflows.Workflow):
|
||||
net_id=context.get("cluster_general_neutron_management_network",
|
||||
None))
|
||||
|
||||
savanna.job_executions.create(
|
||||
sahara.job_executions.create(
|
||||
context["job_general_job"],
|
||||
cluster.id,
|
||||
context["job_general_job_input"],
|
||||
|
@ -19,7 +19,7 @@ import logging
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from horizon import tables
|
||||
from saharadashboard.api.client import client as savannaclient
|
||||
from saharadashboard.api.client import client as saharaclient
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
@ -60,8 +60,8 @@ class DeleteTemplate(tables.BatchAction):
|
||||
return True
|
||||
|
||||
def action(self, request, template_id):
|
||||
savanna = savannaclient(request)
|
||||
savanna.node_group_templates.delete(template_id)
|
||||
sahara = saharaclient(request)
|
||||
sahara.node_group_templates.delete(template_id)
|
||||
|
||||
|
||||
def render_processes(nodegroup_template):
|
||||
|
@ -18,7 +18,7 @@ import logging
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
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
|
||||
|
||||
# horizon.api is for backward compatibility with folsom
|
||||
@ -36,8 +36,8 @@ class GeneralTab(tabs.Tab):
|
||||
|
||||
def get_context_data(self, request):
|
||||
template_id = self.tab_group.kwargs['template_id']
|
||||
savanna = savannaclient(request)
|
||||
template = savanna.node_group_templates.get(template_id)
|
||||
sahara = saharaclient(request)
|
||||
template = sahara.node_group_templates.get(template_id)
|
||||
flavor = nova.flavor_get(request, template.flavor_id)
|
||||
return {"template": template, "flavor": flavor}
|
||||
|
||||
@ -49,8 +49,8 @@ class ConfigsTab(tabs.Tab):
|
||||
|
||||
def get_context_data(self, request):
|
||||
template_id = self.tab_group.kwargs['template_id']
|
||||
savanna = savannaclient(request)
|
||||
template = savanna.node_group_templates.get(template_id)
|
||||
sahara = saharaclient(request)
|
||||
template = sahara.node_group_templates.get(template_id)
|
||||
return {"template": template}
|
||||
|
||||
|
||||
|
@ -19,7 +19,7 @@ from horizon import tables
|
||||
from horizon import tabs
|
||||
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.tabs as _tabs
|
||||
@ -34,8 +34,8 @@ class NodegroupTemplatesView(tables.DataTableView):
|
||||
template_name = 'nodegroup_templates/nodegroup_templates.html'
|
||||
|
||||
def get_data(self):
|
||||
savanna = savannaclient(self.request)
|
||||
nodegroup_templates = savanna.node_group_templates.list()
|
||||
sahara = saharaclient(self.request)
|
||||
nodegroup_templates = sahara.node_group_templates.list()
|
||||
return nodegroup_templates
|
||||
|
||||
|
||||
@ -81,8 +81,8 @@ class CopyNodegroupTemplateView(workflows.WorkflowView):
|
||||
def get_object(self, *args, **kwargs):
|
||||
if not hasattr(self, "_object"):
|
||||
template_id = self.kwargs['template_id']
|
||||
savanna = savannaclient(self.request)
|
||||
template = savanna.node_group_templates.get(template_id)
|
||||
sahara = saharaclient(self.request)
|
||||
template = sahara.node_group_templates.get(template_id)
|
||||
self._object = template
|
||||
return self._object
|
||||
|
||||
|
@ -17,7 +17,7 @@ import logging
|
||||
|
||||
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
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
@ -27,10 +27,10 @@ class CopyNodegroupTemplate(create_flow.ConfigureNodegroupTemplate):
|
||||
success_message = _("Node Group Template copy %s created")
|
||||
|
||||
def __init__(self, request, context_seed, entry_point, *args, **kwargs):
|
||||
savanna = savannaclient(request)
|
||||
sahara = saharaclient(request)
|
||||
|
||||
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)
|
||||
|
||||
plugin = template.plugin_name
|
||||
@ -65,7 +65,7 @@ class CopyNodegroupTemplate(create_flow.ConfigureNodegroupTemplate):
|
||||
fields['floating_ip_pool'].initial = template.floating_ip_pool
|
||||
|
||||
processes_dict = dict()
|
||||
plugin_details = savanna.plugins.get_version_details(
|
||||
plugin_details = sahara.plugins.get_version_details(
|
||||
plugin,
|
||||
hadoop_version)
|
||||
plugin_node_processes = plugin_details.node_processes
|
||||
|
@ -21,7 +21,7 @@ from django.utils.translation import ugettext as _
|
||||
from horizon import exceptions
|
||||
from horizon import workflows
|
||||
|
||||
from saharadashboard.api import client as savannaclient
|
||||
from saharadashboard.api import client as saharaclient
|
||||
from saharadashboard.utils import importutils
|
||||
from savannaclient.api import base as api_base
|
||||
|
||||
@ -79,13 +79,13 @@ class GeneralConfigAction(workflows.Action):
|
||||
def __init__(self, request, *args, **kwargs):
|
||||
super(GeneralConfigAction, self).__init__(request, *args, **kwargs)
|
||||
|
||||
savanna = savannaclient.client(request)
|
||||
hlps = helpers.Helpers(savanna)
|
||||
sahara = saharaclient.client(request)
|
||||
hlps = helpers.Helpers(sahara)
|
||||
|
||||
plugin, hadoop_version = whelpers.\
|
||||
get_plugin_and_hadoop_version(request)
|
||||
process_choices = []
|
||||
version_details = savanna.plugins.get_version_details(plugin,
|
||||
version_details = sahara.plugins.get_version_details(plugin,
|
||||
hadoop_version)
|
||||
|
||||
for service, processes in version_details.node_processes.items():
|
||||
@ -93,7 +93,7 @@ class GeneralConfigAction(workflows.Action):
|
||||
process_choices.append(
|
||||
(str(service) + ":" + str(process), process))
|
||||
|
||||
if not savannaclient.AUTO_ASSIGNMENT_ENABLED:
|
||||
if not saharaclient.AUTO_ASSIGNMENT_ENABLED:
|
||||
pools = network.floating_ip_pools_list(request)
|
||||
pool_choices = [(pool.id, pool.name) for pool in pools]
|
||||
pool_choices.insert(0, (None, "Do not assign floating IPs"))
|
||||
@ -175,8 +175,8 @@ class ConfigureNodegroupTemplate(whelpers.ServiceParametersWorkflow,
|
||||
default_steps = (GeneralConfig,)
|
||||
|
||||
def __init__(self, request, context_seed, entry_point, *args, **kwargs):
|
||||
savanna = savannaclient.client(request)
|
||||
hlps = helpers.Helpers(savanna)
|
||||
sahara = saharaclient.client(request)
|
||||
hlps = helpers.Helpers(sahara)
|
||||
|
||||
plugin, hadoop_version = whelpers.\
|
||||
get_plugin_and_hadoop_version(request)
|
||||
@ -224,7 +224,7 @@ class ConfigureNodegroupTemplate(whelpers.ServiceParametersWorkflow,
|
||||
|
||||
def handle(self, request, context):
|
||||
try:
|
||||
savanna = savannaclient.client(request)
|
||||
sahara = saharaclient.client(request)
|
||||
|
||||
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_size = context["general_volumes_size"]
|
||||
|
||||
savanna.node_group_templates.create(
|
||||
sahara.node_group_templates.create(
|
||||
name=context["general_nodegroup_name"],
|
||||
plugin_name=plugin,
|
||||
hadoop_version=hadoop_version,
|
||||
@ -271,8 +271,8 @@ class SelectPluginAction(workflows.Action,
|
||||
def __init__(self, request, *args, **kwargs):
|
||||
super(SelectPluginAction, self).__init__(request, *args, **kwargs)
|
||||
|
||||
savanna = savannaclient.client(request)
|
||||
self._generate_plugin_version_fields(savanna)
|
||||
sahara = saharaclient.client(request)
|
||||
self._generate_plugin_version_fields(sahara)
|
||||
|
||||
class Meta:
|
||||
name = _("Select plugin and hadoop version")
|
||||
|
@ -18,7 +18,7 @@ from django.utils.translation import ugettext_lazy as _
|
||||
import logging
|
||||
|
||||
from horizon import tabs
|
||||
from saharadashboard.api.client import client as savannaclient
|
||||
from saharadashboard.api.client import client as saharaclient
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
@ -30,8 +30,8 @@ class DetailsTab(tabs.Tab):
|
||||
|
||||
def get_context_data(self, request):
|
||||
plugin_id = self.tab_group.kwargs['plugin_id']
|
||||
savanna = savannaclient(request)
|
||||
plugin = savanna.plugins.get(plugin_id)
|
||||
sahara = saharaclient(request)
|
||||
plugin = sahara.plugins.get(plugin_id)
|
||||
return {"plugin": plugin}
|
||||
|
||||
|
||||
|
@ -18,7 +18,7 @@ from horizon import tables
|
||||
from horizon import tabs
|
||||
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.tabs import PluginDetailsTabs
|
||||
|
||||
@ -30,8 +30,8 @@ class PluginsView(tables.DataTableView):
|
||||
template_name = 'plugins/plugins.html'
|
||||
|
||||
def get_data(self):
|
||||
savanna = savannaclient(self.request)
|
||||
return savanna.plugins.list()
|
||||
sahara = saharaclient(self.request)
|
||||
return sahara.plugins.list()
|
||||
|
||||
|
||||
class PluginDetailsView(tabs.TabView):
|
||||
|
@ -8,12 +8,12 @@
|
||||
$("[name=job_binary_password]").closest(".control-group").hide();
|
||||
$("[name=job_binary_file]").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() {
|
||||
var label = $("#id_job_binary_url_label");
|
||||
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 username = $("[name=job_binary_username]").closest(".control-group");
|
||||
var password = $("[name=job_binary_password]").closest(".control-group");
|
||||
@ -44,9 +44,9 @@
|
||||
});
|
||||
$("#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_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 script_name = $("[name=job_binary_script_name]").closest(".control-group");
|
||||
var script_text = $("[name=job_binary_script]").closest(".control-group");
|
||||
@ -68,7 +68,7 @@
|
||||
break;
|
||||
}
|
||||
});
|
||||
$("#job_binary_savanna_internal").change();
|
||||
$("#job_binary_internal").change();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
@ -250,16 +250,16 @@ class UITestCase(unittest2.TestCase):
|
||||
cfg.common.password)
|
||||
|
||||
elif storage_type == 'Internal database':
|
||||
savanna_binary = parameters_of_storage['Internal binary']
|
||||
internal_binary = parameters_of_storage['Internal binary']
|
||||
driver.find_element_by_xpath(
|
||||
"//select[@id='id_job_binary_savanna_internal']/option[text()"
|
||||
"='%s']" % savanna_binary).click()
|
||||
if savanna_binary == '*Upload a new file':
|
||||
"//select[@id='id_job_binary_internal']/option[text()"
|
||||
"='%s']" % internal_binary).click()
|
||||
if internal_binary == '*Upload a new file':
|
||||
file = '%s/saharadashboard/tests/resources/%s' % (
|
||||
os.getcwd(), parameters_of_storage['filename'])
|
||||
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",
|
||||
parameters_of_storage['script_name'])
|
||||
self.find_clear_send(by.By.ID, "id_job_binary_script",
|
||||
|
@ -21,7 +21,7 @@ common_group = cfg.OptGroup(name='common', title="common configs")
|
||||
CommonGroup = [
|
||||
cfg.StrOpt('base_url',
|
||||
default='http://127.0.0.1:8080',
|
||||
help="savanna url"),
|
||||
help="sahara url"),
|
||||
cfg.StrOpt('user',
|
||||
default='admin',
|
||||
help="keystone user"),
|
||||
@ -88,7 +88,7 @@ VanillaGroup = [
|
||||
cfg.DictOpt('processes',
|
||||
default={"NN": 0, "DN": 1, "SNN": 2,
|
||||
"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',
|
||||
default='ubuntu_savanna_latest',
|
||||
help="image name for start vanilla cluster")
|
||||
|
@ -19,7 +19,7 @@ from django.utils.translation import ugettext as _
|
||||
|
||||
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
|
||||
|
||||
|
||||
@ -36,10 +36,10 @@ def anti_affinity_field():
|
||||
|
||||
|
||||
def populate_anti_affinity_choices(self, request, context):
|
||||
savanna = savannaclient(request)
|
||||
sahara = saharaclient(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 = []
|
||||
for service, processes in version_details.node_processes.items():
|
||||
for process in processes:
|
||||
@ -49,7 +49,7 @@ def populate_anti_affinity_choices(self, request, context):
|
||||
if cluster_template_id is None:
|
||||
selected_processes = request.REQUEST.get("aa_groups", [])
|
||||
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
|
||||
|
||||
checked_dict = dict()
|
||||
|
@ -149,8 +149,8 @@ def get_plugin_and_hadoop_version(request):
|
||||
|
||||
|
||||
class PluginAndVersionMixin(object):
|
||||
def _generate_plugin_version_fields(self, savanna):
|
||||
plugins = savanna.plugins.list()
|
||||
def _generate_plugin_version_fields(self, sahara):
|
||||
plugins = sahara.plugins.list()
|
||||
plugin_choices = [(plugin.name, plugin.title) for plugin in plugins]
|
||||
|
||||
self.fields["plugin_name"] = forms.ChoiceField(
|
||||
|
Loading…
Reference in New Issue
Block a user