Commit ff470565 authored by Dmitry Volodin's avatar Dmitry Volodin Committed by Andrey Vertiprahov
Browse files

black: Rest of stuff

parent 42594247
......@@ -217,19 +217,19 @@ class Permission(NOCModel):
# @todo: add implied permissions
p = Permission(name=name, implied=get_implied(name))
p.save()
print ("+ %s" % name)
print("+ %s" % name)
created_perms[name] = p
# Check implied permissions match
for name in old_perms.intersection(new_perms):
implied = get_implied(name)
p = Permission.objects.get(name=name)
if p.implied != implied:
print ("~ %s" % name)
print("~ %s" % name)
p.implied = implied
p.save()
# Deleted permissions
for name in old_perms - new_perms:
print ("- %s" % name)
print("- %s" % name)
Permission.objects.get(name=name).delete()
# Diverge created permissions
for name in created_perms:
......@@ -240,7 +240,7 @@ class Permission(NOCModel):
op = Permission.get_by_name(op_name)
if not op:
continue
print (": %s -> (%s, %s)" % (op_name, op_name, name))
print(": %s -> (%s, %s)" % (op_name, op_name, name))
# Migrate users
dp = created_perms[name]
for u in op.users.all():
......
......@@ -39,4 +39,4 @@ class UserContact(NOCModel):
params = models.CharField("Params", max_length=256)
def __str__(self):
return u"%s %s %s" % (self.user.username, self.time_pattern.name, self.notification_method)
return "%s %s %s" % (self.user.username, self.time_pattern.name, self.notification_method)
......@@ -22,9 +22,9 @@ class BaseFact(object):
self.managed_object = None
def dump(self):
print ("- %s:" % self.__class__.__name__)
print("- %s:" % self.__class__.__name__)
for a in self.iter_attrs():
print (" %s: %s" % (a, getattr(self, a)))
print(" %s: %s" % (a, getattr(self, a)))
@property
def cls(self):
......
......@@ -30,9 +30,9 @@ class Error(BaseFact):
def __str__(self):
if self.obj:
return u"Error %s: %s" % (self.type, self.obj)
return "Error %s: %s" % (self.type, self.obj)
else:
return u"Error %s" % self.type
return "Error %s" % self.type
@property
def obj(self):
......
......@@ -67,7 +67,7 @@ class Interface(BaseFact):
self.aggregated_interface = aggregated_interface
def __str__(self):
return u"Interface %s" % self.name
return "Interface %s" % self.name
@property
def description(self):
......
......@@ -26,7 +26,7 @@ class NTPServer(BaseFact):
self.ip = ip
def __str__(self):
return u"NTPServer %s" % self.ip
return "NTPServer %s" % self.ip
@property
def ip(self):
......
......@@ -29,7 +29,7 @@ class Service(BaseFact):
self.port = port
def __str__(self):
return u"Service %s" % self.name
return "Service %s" % self.name
@property
def name(self):
......
......@@ -56,9 +56,9 @@ class StaticRoute(BaseFact):
def __str__(self):
if self.vrf:
return u"StaticRoute %s:%s" % (self.vrf, self.prefix)
return "StaticRoute %s:%s" % (self.vrf, self.prefix)
else:
return u"StaticRoute %s" % self.prefix
return "StaticRoute %s" % self.prefix
@property
def prefix(self):
......
......@@ -112,7 +112,7 @@ class SubInterface(BaseFact):
self.traffic_control_unicast = traffic_control_unicast
def __str__(self):
return u"SubInterface %s" % self.name
return "SubInterface %s" % self.name
@property
def description(self):
......
......@@ -26,7 +26,7 @@ class SyslogHost(BaseFact):
self.ip = ip
def __str__(self):
return u"SyslogHost %s" % self.ip
return "SyslogHost %s" % self.ip
@property
def ip(self):
......
......@@ -28,7 +28,7 @@ class User(BaseFact):
self.groups = groups
def __str__(self):
return u"User %s" % self.name
return "User %s" % self.name
@property
def name(self):
......
......@@ -27,9 +27,9 @@ class VLAN(BaseFact):
self.name = name
def __str__(self):
r = u"VLAN %d" % self.id
r = "VLAN %d" % self.id
if self.name and self.name != str(self.id):
r += u" (%s)" % self.name
r += " (%s)" % self.name
return r
@property
......
......@@ -27,7 +27,7 @@ class VRF(BaseFact):
self.rd = rd
def __str__(self):
return u"VRF %s" % self.name
return "VRF %s" % self.name
@property
def name(self):
......
......@@ -42,4 +42,4 @@ class ObjectNotify(NOCModel):
)
def __str__(self):
return u"(%s, %s, %s)" % (self.type, self.administrative_domain, self.notification_group)
return "(%s, %s, %s)" % (self.type, self.administrative_domain, self.notification_group)
......@@ -46,4 +46,4 @@ class ValidationPolicySettings(Document):
policies = ListField(EmbeddedDocumentField(ValidationPolicyItem))
def __str__(self):
return u"%s: %s" % (self.model_id, self.object_id)
return "%s: %s" % (self.model_id, self.object_id)
......@@ -43,7 +43,7 @@ class SelectorItem(EmbeddedDocument):
action = StringField(choices=ACTIONS)
def __str__(self):
return u"%s: %s" % (self.action, self.selector.name)
return "%s: %s" % (self.action, self.selector.name)
@six.python_2_unicode_compatible
......@@ -52,7 +52,7 @@ class ObjectItem(EmbeddedDocument):
action = StringField(choices=ACTIONS)
def __str__(self):
return u"%s: %s" % (self.action, self.object.name)
return "%s: %s" % (self.action, self.object.name)
@six.python_2_unicode_compatible
......
......@@ -2,7 +2,7 @@
# ---------------------------------------------------------------------
# Config parsing basevalidator
# ---------------------------------------------------------------------
# Copyright (C) 2007-2018 The NOC Project
# Copyright (C) 2007-2019 The NOC Project
# See LICENSE for details
# ---------------------------------------------------------------------
......@@ -10,7 +10,7 @@
from __future__ import absolute_import
import logging
# Django modules
# Third-party modules
from django.template import Template, Context
# NOC modules
......
......@@ -332,5 +332,5 @@ MIB = {
"AIRESPACE-SWITCHING-MIB::stpInstanceTopologyChangeTrap": "1.3.6.1.4.1.14179.1.50.11",
"AIRESPACE-SWITCHING-MIB::powerSupplyStatusChangeTrap": "1.3.6.1.4.1.14179.1.50.12",
"AIRESPACE-SWITCHING-MIB::bsnSwitchingGroups": "1.3.6.1.4.1.14179.1.51",
"AIRESPACE-SWITCHING-MIB::bsnSwitchingCompliances": "1.3.6.1.4.1.14179.1.52"
"AIRESPACE-SWITCHING-MIB::bsnSwitchingCompliances": "1.3.6.1.4.1.14179.1.52",
}
......@@ -1216,5 +1216,5 @@ MIB = {
"AIRESPACE-WIRELESS-MIB::bsnAPGroupsVlanMappingInterfaceName": "1.3.6.1.4.1.14179.2.10.3.1.2",
"AIRESPACE-WIRELESS-MIB::bsnAPGroupsVlanMappingRowStatus": "1.3.6.1.4.1.14179.2.10.3.1.20",
"AIRESPACE-WIRELESS-MIB::bsnWrasGroups": "1.3.6.1.4.1.14179.2.50",
"AIRESPACE-WIRELESS-MIB::bsnWrasCompliances": "1.3.6.1.4.1.14179.2.51"
"AIRESPACE-WIRELESS-MIB::bsnWrasCompliances": "1.3.6.1.4.1.14179.2.51",
}
......@@ -84,5 +84,5 @@ MIB = {
"BRIDGE-MIB::dot1dStaticStatus": "1.3.6.1.2.1.17.5.1.1.4",
"BRIDGE-MIB::dot1dConformance": "1.3.6.1.2.1.17.8",
"BRIDGE-MIB::dot1dGroups": "1.3.6.1.2.1.17.8.1",
"BRIDGE-MIB::dot1dCompliances": "1.3.6.1.2.1.17.8.2"
"BRIDGE-MIB::dot1dCompliances": "1.3.6.1.2.1.17.8.2",
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment