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