"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "openstack_dashboard/dashboards/project/instances/views.py" between
horizon-20.1.1.tar.gz and horizon-20.1.2.tar.gz

About: OpenStack Horizon (Optional Service: Dashboard) provides a web-based self-service portal to interact with underlying OpenStack services, such as launching an instance, assigning IP addresses and configuring access controls.
The "Xena" series (latest release).

views.py  (horizon-20.1.1):views.py  (horizon-20.1.2)
skipping to change at line 54 skipping to change at line 54
from openstack_dashboard.dashboards.project.instances \ from openstack_dashboard.dashboards.project.instances \
import console as project_console import console as project_console
from openstack_dashboard.dashboards.project.instances \ from openstack_dashboard.dashboards.project.instances \
import forms as project_forms import forms as project_forms
from openstack_dashboard.dashboards.project.instances \ from openstack_dashboard.dashboards.project.instances \
import tables as project_tables import tables as project_tables
from openstack_dashboard.dashboards.project.instances \ from openstack_dashboard.dashboards.project.instances \
import tabs as project_tabs import tabs as project_tabs
from openstack_dashboard.dashboards.project.instances \ from openstack_dashboard.dashboards.project.instances \
import utils as instance_utils
from openstack_dashboard.dashboards.project.instances \
import workflows as project_workflows import workflows as project_workflows
from openstack_dashboard.dashboards.project.networks.ports \ from openstack_dashboard.dashboards.project.networks.ports \
import views as port_views import views as port_views
from openstack_dashboard.utils import futurist_utils from openstack_dashboard.utils import futurist_utils
from openstack_dashboard.views import get_url_with_pagination from openstack_dashboard.views import get_url_with_pagination
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
class IndexView(tables.PagedTableMixin, tables.DataTableView): class IndexView(tables.PagedTableMixin, tables.DataTableView):
table_class = project_tables.InstancesTable table_class = project_tables.InstancesTable
skipping to change at line 593 skipping to change at line 595
@memoized.memoized_method @memoized.memoized_method
def get_object(self, *args, **kwargs): def get_object(self, *args, **kwargs):
instance_id = self.kwargs['instance_id'] instance_id = self.kwargs['instance_id']
try: try:
instance = api.nova.server_get(self.request, instance_id) instance = api.nova.server_get(self.request, instance_id)
except Exception: except Exception:
redirect = reverse("horizon:project:instances:index") redirect = reverse("horizon:project:instances:index")
msg = _('Unable to retrieve instance details.') msg = _('Unable to retrieve instance details.')
exceptions.handle(self.request, msg, redirect=redirect) exceptions.handle(self.request, msg, redirect=redirect)
flavor_id = instance.flavor['id']
flavors = self.get_flavors() flavors = self.get_flavors()
if flavor_id in flavors: flavor = instance_utils.resolve_flavor(self.request, instance, flavors)
instance.flavor_name = flavors[flavor_id].name instance.flavor_name = flavor.name
else:
try:
flavor = api.nova.flavor_get(self.request, flavor_id)
instance.flavor_name = flavor.name
except Exception:
msg = _('Unable to retrieve flavor information for instance '
'"%s".') % instance_id
exceptions.handle(self.request, msg, ignore=True)
instance.flavor_name = _("Not available")
return instance return instance
@memoized.memoized_method @memoized.memoized_method
def get_flavors(self, *args, **kwargs): def get_flavors(self, *args, **kwargs):
try: try:
flavors = api.nova.flavor_list(self.request) flavors = api.nova.flavor_list(self.request)
return OrderedDict((str(flavor.id), flavor) for flavor in flavors) return OrderedDict((str(flavor.id), flavor) for flavor in flavors)
except Exception: except Exception:
redirect = reverse("horizon:project:instances:index") redirect = reverse("horizon:project:instances:index")
exceptions.handle(self.request, exceptions.handle(self.request,
_('Unable to retrieve flavors.'), _('Unable to retrieve flavors.'),
redirect=redirect) redirect=redirect)
def get_initial(self): def get_initial(self):
initial = super().get_initial() initial = super().get_initial()
_object = self.get_object() _object = self.get_object()
if _object: if _object:
initial.update( initial.update(
{'instance_id': self.kwargs['instance_id'], {'instance_id': self.kwargs['instance_id'],
'name': getattr(_object, 'name', None), 'name': getattr(_object, 'name', None),
'old_flavor_id': _object.flavor['id'],
'old_flavor_name': getattr(_object, 'flavor_name', ''), 'old_flavor_name': getattr(_object, 'flavor_name', ''),
'flavors': self.get_flavors()}) 'flavors': self.get_flavors()})
return initial return initial
class AttachInterfaceView(forms.ModalFormView): class AttachInterfaceView(forms.ModalFormView):
form_class = project_forms.AttachInterface form_class = project_forms.AttachInterface
template_name = 'project/instances/attach_interface.html' template_name = 'project/instances/attach_interface.html'
page_title = _("Attach Interface") page_title = _("Attach Interface")
form_id = "attach_interface_form" form_id = "attach_interface_form"
submit_label = _("Attach Interface") submit_label = _("Attach Interface")
 End of changes. 4 change blocks. 
13 lines changed or deleted 4 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)