Ejemplo n.º 1
0
# See the License for the specific language governing permissions and
# limitations under the License.

import json

from django.utils.translation import ugettext_lazy as _
from horizon import exceptions
from horizon import forms
from horizon import messages

from savannaclient.api import base as api_base
from savannadashboard.api import client as savannaclient
from savannadashboard.utils import importutils

# horizon.api is for backward compatibility with folsom
glance = importutils.import_any('openstack_dashboard.api.glance',
                                'horizon.api.glance')


class ImageForm(forms.SelfHandlingForm):
    image_id = forms.CharField(widget=forms.HiddenInput())
    tags_list = forms.CharField(widget=forms.HiddenInput())
    user_name = forms.CharField(max_length=80, label=_("User Name"))
    description = forms.CharField(max_length=80,
                                  label=_("Description"),
                                  required=False,
                                  widget=forms.Textarea(attrs={'cols': 80,
                                                               'rows': 20}))

    def handle(self, request, data):
        try:
            savanna = savannaclient.client(request)
Ejemplo n.º 2
0
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import logging

from django.utils.translation import ugettext_lazy as _

from horizon import tabs

from savannadashboard.api import client as savannaclient
from savannadashboard.utils import importutils
from savannadashboard.utils import workflow_helpers as helpers
nova = importutils.import_any('openstack_dashboard.api.nova',
                              'horizon.api.nova')

LOG = logging.getLogger(__name__)


class GeneralTab(tabs.Tab):
    name = _("General Info")
    slug = "cluster_template_details_tab"
    template_name = ("cluster_templates/_details.html")

    def get_context_data(self, request):
        template_id = self.tab_group.kwargs['template_id']
        savanna = savannaclient.Client(request)
        template = savanna.cluster_templates.get(template_id)
        return {"template": template}
Ejemplo n.º 3
0
# See the License for the specific language governing permissions and
# limitations under the License.

import logging

from django.utils.translation import ugettext_lazy as _

from horizon import tables
from horizon import tabs

from savannadashboard.utils import compatibility
from savannadashboard.utils import importutils
from savannadashboard.utils import workflow_helpers as helpers

neutron = importutils.import_any('openstack_dashboard.api.quantum',
                                 'horizon.api.quantum',
                                 'openstack_dashboard.api.neutron')
nova = importutils.import_any('openstack_dashboard.api.nova',
                              'horizon.api.nova')
glance = importutils.import_any('openstack_dashboard.api.glance',
                                'horizon.api.glance')


from savannadashboard.api.client import client as savannaclient

LOG = logging.getLogger(__name__)


class GeneralTab(tabs.Tab):
    name = _("General Info")
    slug = "cluster_details_tab"
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from django.utils.translation import ugettext as _
from horizon import exceptions
from savannadashboard.utils import importutils

neutron = importutils.import_any('openstack_dashboard.api.quantum',
                                 'openstack_dashboard.api.neutron',
                                 'horizon.api.quantum',
                                 'horizon.api.neutron')


def populate_neutron_management_network_choices(self, request, context):
    try:
        tenant_id = self.request.user.tenant_id
        networks = neutron.network_list_for_tenant(request, tenant_id)
        for n in networks:
            n.set_id_as_name_if_empty()
        network_list = [(network.id, network.name) for network in networks]
    except Exception:
        network_list = []
        exceptions.handle(request,
                          _('Unable to retrieve networks.'))
    return network_list
Ejemplo n.º 5
0
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import logging

from horizon import exceptions

from savannaclient.api import base as api_base
from savannaclient.api import client as api_client
from savannadashboard.utils import importutils

# horizon.api is for backward compatibility with folsom
base = importutils.import_any('openstack_dashboard.api.base',
                              'horizon.api.base')

keystone = importutils.import_any('openstack_dashboard.api.keystone',
                                  'horizon.api.keystone')

LOG = logging.getLogger(__name__)


def get_horizon_parameter(name, default_value):
    import openstack_dashboard.settings

    if hasattr(openstack_dashboard.settings, name):
        return getattr(openstack_dashboard.settings, name)
    else:
        logging.info('Parameter %s is not found in local_settings.py, '
                     'using default "%s"' % (name, default_value))
Ejemplo n.º 6
0
# See the License for the specific language governing permissions and
# limitations under the License.

import logging

from django.utils.translation import ugettext_lazy as _

from horizon import tables
from horizon import tabs

from savannadashboard.utils import compatibility
from savannadashboard.utils import importutils
from savannadashboard.utils import workflow_helpers as helpers

neutron = importutils.import_any(
    "openstack_dashboard.api.quantum", "horizon.api.quantum", "openstack_dashboard.api.neutron"
)
nova = importutils.import_any("openstack_dashboard.api.nova", "horizon.api.nova")
glance = importutils.import_any("openstack_dashboard.api.glance", "horizon.api.glance")


from savannadashboard.api import client as savannaclient

LOG = logging.getLogger(__name__)


class GeneralTab(tabs.Tab):
    name = _("General Info")
    slug = "cluster_details_tab"
    template_name = "clusters/_details.html"