"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "openstack_dashboard/dashboards/project/instances/tables.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).

tables.py  (horizon-20.1.1):tables.py  (horizon-20.1.2)
skipping to change at line 41 skipping to change at line 41
from horizon import exceptions from horizon import exceptions
from horizon import messages from horizon import messages
from horizon import tables from horizon import tables
from horizon.templatetags import sizeformat from horizon.templatetags import sizeformat
from horizon.utils import filters from horizon.utils import filters
from openstack_dashboard import api from openstack_dashboard import api
from openstack_dashboard.dashboards.project.floating_ips import workflows from openstack_dashboard.dashboards.project.floating_ips import workflows
from openstack_dashboard.dashboards.project.instances import tabs from openstack_dashboard.dashboards.project.instances import tabs
from openstack_dashboard.dashboards.project.instances \
import utils as instance_utils
from openstack_dashboard.dashboards.project.instances.workflows \ from openstack_dashboard.dashboards.project.instances.workflows \
import resize_instance import resize_instance
from openstack_dashboard.dashboards.project.instances.workflows \ from openstack_dashboard.dashboards.project.instances.workflows \
import update_instance import update_instance
from openstack_dashboard import policy from openstack_dashboard import policy
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__)
ACTIVE_STATES = ("ACTIVE",) ACTIVE_STATES = ("ACTIVE",)
skipping to change at line 318 skipping to change at line 320
), ),
) )
def allowed(self, request, instance=None): def allowed(self, request, instance=None):
if not instance: if not instance:
return False return False
self.suspended = instance.status == "SUSPENDED" self.suspended = instance.status == "SUSPENDED"
if self.suspended: if self.suspended:
self.current_present_action = RESUME self.current_present_action = RESUME
policy_rules = ( policy_rules = (
("compute", "os_compute_api:os-rescue"),) ("compute", "os_compute_api:os-suspend-server:resume"),)
else: else:
self.current_present_action = SUSPEND self.current_present_action = SUSPEND
policy_rules = ( policy_rules = (
("compute", "os_compute_api:os-suspend-server:suspend"),) ("compute", "os_compute_api:os-suspend-server:suspend"),)
has_permission = policy.check( has_permission = policy.check(
policy_rules, request, policy_rules, request,
target={'project_id': getattr(instance, 'tenant_id', None)}) target={'project_id': getattr(instance, 'tenant_id', None)})
return (has_permission and return (has_permission and
skipping to change at line 763 skipping to change at line 765
message = format_lazy('{preamble}: {message}', message = format_lazy('{preamble}: {message}',
preamble=preamble, message=message) preamble=preamble, message=message)
return message return message
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):
instance = api.nova.server_get(request, instance_id) instance = api.nova.server_get(request, instance_id)
try: try:
instance.full_flavor = api.nova.flavor_get(request, instance.full_flavor = instance_utils.resolve_flavor(request,
instance.flavor["id"]) instance)
except Exception: except Exception:
exceptions.handle(request, exceptions.handle(request,
_('Unable to retrieve flavor information ' _('Unable to retrieve flavor information '
'for instance "%s".') % instance_id, 'for instance "%s".') % instance_id,
ignore=True) ignore=True)
try: try:
api.network.servers_update_addresses(request, [instance]) api.network.servers_update_addresses(request, [instance])
except Exception: except Exception:
exceptions.handle(request, exceptions.handle(request,
_('Unable to retrieve Network information ' _('Unable to retrieve Network information '
skipping to change at line 1005 skipping to change at line 1007
if instance.full_flavor.disk > 0: if instance.full_flavor.disk > 0:
size_disk = sizeformat.diskgbformat(instance.full_flavor.disk) size_disk = sizeformat.diskgbformat(instance.full_flavor.disk)
else: else:
size_disk = _("%s GB") % "0" size_disk = _("%s GB") % "0"
context = { context = {
"name": instance.full_flavor.name, "name": instance.full_flavor.name,
"id": instance.id, "id": instance.id,
"size_disk": size_disk, "size_disk": size_disk,
"size_ram": size_ram, "size_ram": size_ram,
"vcpus": instance.full_flavor.vcpus, "vcpus": instance.full_flavor.vcpus,
"flavor_id": instance.full_flavor.id "flavor_id": getattr(instance.full_flavor, 'id', None)
} }
return template.loader.render_to_string(template_name, context) return template.loader.render_to_string(template_name, context)
return _("Not available") return _("Not available")
def get_keyname(instance): def get_keyname(instance):
if hasattr(instance, "key_name"): if hasattr(instance, "key_name"):
keyname = instance.key_name keyname = instance.key_name
return keyname return keyname
return _("Not available") return _("Not available")
 End of changes. 4 change blocks. 
4 lines changed or deleted 6 lines changed or added

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