Merge "Prevent erroneous log message when accessing security rules."
This commit is contained in:
commit
5cfbf304cc
@ -48,10 +48,11 @@ class APIResourceWrapper(object):
|
||||
# __getattr__ won't find properties
|
||||
return self._apiresource.__getattribute__(attr)
|
||||
else:
|
||||
LOG.debug('Attempted to access unknown attribute "%s" on'
|
||||
' APIResource object of type "%s" wrapping resource of'
|
||||
' type "%s"' % (attr, self.__class__,
|
||||
self._apiresource.__class__))
|
||||
msg = ('Attempted to access unknown attribute "%s" on '
|
||||
'APIResource object of type "%s" wrapping resource of '
|
||||
'type "%s".') % (attr, self.__class__,
|
||||
self._apiresource.__class__)
|
||||
LOG.debug(exceptions.error_color(msg))
|
||||
raise AttributeError(attr)
|
||||
|
||||
|
||||
@ -74,7 +75,7 @@ class APIDictWrapper(object):
|
||||
except KeyError:
|
||||
msg = 'Unknown attribute "%(attr)s" on APIResource object ' \
|
||||
'of type "%(cls)s"' % {'attr': attr, 'cls': self.__class__}
|
||||
LOG.debug(msg)
|
||||
LOG.debug(exceptions.error_color(msg))
|
||||
raise AttributeError(msg)
|
||||
|
||||
def __getitem__(self, item):
|
||||
|
@ -162,11 +162,11 @@ class SecurityGroup(APIResourceWrapper):
|
||||
@property
|
||||
def rules(self):
|
||||
"""Wraps transmitted rule info in the novaclient rule class."""
|
||||
if not hasattr(self, "_rules"):
|
||||
if "_rules" not in self.__dict__:
|
||||
manager = nova_rules.SecurityGroupRuleManager
|
||||
self._rules = [nova_rules.SecurityGroupRule(manager, rule) for \
|
||||
rule in self._apiresource.rules]
|
||||
return self._rules
|
||||
return self.__dict__['_rules']
|
||||
|
||||
@rules.setter
|
||||
def rules(self, value):
|
||||
@ -330,11 +330,11 @@ def server_security_groups(request, instance_id):
|
||||
% instance_id)
|
||||
if body:
|
||||
# Wrap data in SG objects as novaclient would.
|
||||
sg_objects = [NovaSecurityGroup(nclient.security_groups, sg) for
|
||||
sg in body.get('security_groups', [])]
|
||||
sg_objs = [NovaSecurityGroup(nclient.security_groups, sg, loaded=True)
|
||||
for sg in body.get('security_groups', [])]
|
||||
# Then wrap novaclient's object with our own. Yes, sadly wrapping
|
||||
# with two layers of objects is necessary.
|
||||
security_groups = [SecurityGroup(sg) for sg in sg_objects]
|
||||
security_groups = [SecurityGroup(sg) for sg in sg_objs]
|
||||
# Package up the rules, as well.
|
||||
for sg in security_groups:
|
||||
rule_objects = [SecurityGroupRule(rule) for rule in sg.rules]
|
||||
|
@ -25,7 +25,10 @@
|
||||
});
|
||||
|
||||
setInterval(function() {
|
||||
// Don't poll for something that's not there...
|
||||
if ($("#tail_length").length) {
|
||||
horizon.instances.getConsoleLog($("#tail_length"), false);
|
||||
}
|
||||
}, 10000);
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
@ -219,7 +219,7 @@ RECOVERABLE = (keystoneclient.ClientException,
|
||||
RECOVERABLE += tuple(EXCEPTION_CONFIG.get('recoverable', []))
|
||||
|
||||
|
||||
def _error_color(msg):
|
||||
def error_color(msg):
|
||||
return termcolors.colorize(msg, **PALETTE['ERROR'])
|
||||
|
||||
|
||||
@ -280,7 +280,7 @@ def handle(request, message=None, redirect=None, ignore=False,
|
||||
return NotAuthorized
|
||||
request.user_logout()
|
||||
if not force_silence and not handled:
|
||||
log_method(_error_color("Unauthorized: %s" % exc_value))
|
||||
log_method(error_color("Unauthorized: %s" % exc_value))
|
||||
if not handled:
|
||||
# We get some pretty useless error messages back from
|
||||
# some clients, so let's define our own fallback.
|
||||
@ -291,7 +291,7 @@ def handle(request, message=None, redirect=None, ignore=False,
|
||||
if issubclass(exc_type, NOT_FOUND):
|
||||
wrap = True
|
||||
if not force_silence and not handled and (not ignore or force_log):
|
||||
log_method(_error_color("Not Found: %s" % exc_value))
|
||||
log_method(error_color("Not Found: %s" % exc_value))
|
||||
if not ignore and not handled:
|
||||
messages.error(request, message or exc_value)
|
||||
if redirect:
|
||||
@ -302,7 +302,7 @@ def handle(request, message=None, redirect=None, ignore=False,
|
||||
if issubclass(exc_type, RECOVERABLE):
|
||||
wrap = True
|
||||
if not force_silence and not handled and (not ignore or force_log):
|
||||
log_method(_error_color("Recoverable error: %s" % exc_value))
|
||||
log_method(error_color("Recoverable error: %s" % exc_value))
|
||||
if not ignore and not handled:
|
||||
messages.error(request, message or exc_value)
|
||||
if redirect:
|
||||
|
@ -293,10 +293,11 @@ var Horizon = function() {
|
||||
user_decided_length: false,
|
||||
|
||||
getConsoleLog: function(form_element, via_user_submit) {
|
||||
var data;
|
||||
if(this.user_decided_length) {
|
||||
var data = $(form_element).serialize();
|
||||
data = $(form_element).serialize();
|
||||
} else {
|
||||
var data = "length=35";
|
||||
data = "length=35";
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
|
Loading…
x
Reference in New Issue
Block a user