mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
DNS Locations: Rename ipalocationweight to ipaserviceweight
Service weight explains better meaning of attribute than location weight, because location itself have no weight only services have. https://fedorahosted.org/freeipa/ticket/2008 Reviewed-By: Petr Spacek <pspacek@redhat.com>
This commit is contained in:
@@ -72,7 +72,7 @@ class IPASystemRecords(object):
|
||||
|
||||
def __get_server_attrs(self, hostname):
|
||||
server_result = self.api_instance.Command.server_show(hostname)['result']
|
||||
weight = int(server_result.get('ipalocationweight', [u'100'])[0])
|
||||
weight = int(server_result.get('ipaserviceweight', [u'100'])[0])
|
||||
location = server_result.get('ipalocation_location', [None])[0]
|
||||
roles = set(server_result.get('enabled_role_servrole', ()))
|
||||
|
||||
|
||||
@@ -202,12 +202,12 @@ class location_show(LDAPRetrieve):
|
||||
in_location=keys[0], no_members=False)['result']
|
||||
for server in servers:
|
||||
servers_name.append(server['cn'][0])
|
||||
weight = int(server.get('ipalocationweight', [100])[0])
|
||||
weight = int(server.get('ipaserviceweight', [100])[0])
|
||||
weight_sum += weight
|
||||
servers_additional_info[server['cn'][0]] = {
|
||||
'cn': server['cn'],
|
||||
'ipalocationweight': server.get(
|
||||
'ipalocationweight', [u'100']),
|
||||
'ipaserviceweight': server.get(
|
||||
'ipaserviceweight', [u'100']),
|
||||
}
|
||||
|
||||
if not dns_server_in_loc:
|
||||
@@ -218,9 +218,9 @@ class location_show(LDAPRetrieve):
|
||||
dns_server_in_loc = True
|
||||
|
||||
for server in servers_additional_info.values():
|
||||
server['location_relative_weight'] = [
|
||||
server['service_relative_weight'] = [
|
||||
u'{:.1f}%'.format(
|
||||
int(server['ipalocationweight'][0])*100.0/weight_sum)
|
||||
int(server['ipaserviceweight'][0])*100.0/weight_sum)
|
||||
]
|
||||
if servers_name:
|
||||
result['result']['servers_server'] = servers_name
|
||||
|
||||
@@ -53,7 +53,7 @@ class server(LDAPObject):
|
||||
search_attributes = ['cn']
|
||||
default_attributes = [
|
||||
'cn', 'iparepltopomanagedsuffix', 'ipamindomainlevel',
|
||||
'ipamaxdomainlevel', 'ipalocation', 'ipalocationweight'
|
||||
'ipamaxdomainlevel', 'ipalocation', 'ipaserviceweight'
|
||||
]
|
||||
label = _('IPA Servers')
|
||||
label_singular = _('IPA Server')
|
||||
@@ -72,7 +72,7 @@ class server(LDAPObject):
|
||||
'System: Read Locations of IPA Servers': {
|
||||
'ipapermright': {'read', 'search', 'compare'},
|
||||
'ipapermdefaultattr': {
|
||||
'objectclass', 'cn', 'ipalocation', 'ipalocationweight',
|
||||
'objectclass', 'cn', 'ipalocation', 'ipaserviceweight',
|
||||
},
|
||||
'default_privileges': {'DNS Administrators'},
|
||||
},
|
||||
@@ -123,18 +123,18 @@ class server(LDAPObject):
|
||||
flags={'no_search'},
|
||||
),
|
||||
Int(
|
||||
'ipalocationweight?',
|
||||
cli_name='location_weight',
|
||||
label=_('Location weight'),
|
||||
doc=_('Location weight for server'),
|
||||
'ipaserviceweight?',
|
||||
cli_name='service_weight',
|
||||
label=_('Service weight'),
|
||||
doc=_('Weight for server services'),
|
||||
minvalue=0,
|
||||
maxvalue=65535,
|
||||
flags={'no_search'},
|
||||
),
|
||||
Str(
|
||||
'location_relative_weight',
|
||||
label=_('Location relative weight'),
|
||||
doc=_('Location relative weight for server (counts per location)'),
|
||||
'service_relative_weight',
|
||||
label=_('Service relative weight'),
|
||||
doc=_('Relative weight for server services (counts per location)'),
|
||||
flags={'virtual_attribute','no_create', 'no_update', 'no_search'},
|
||||
),
|
||||
Str(
|
||||
@@ -219,7 +219,7 @@ class server_mod(LDAPUpdate):
|
||||
self.api.Object.location.handle_not_found(
|
||||
options['ipalocation_location'])
|
||||
|
||||
if 'ipalocation' or 'ipalocationweight' in entry_attrs:
|
||||
if 'ipalocation' or 'ipaserviceweight' in entry_attrs:
|
||||
server_entry = ldap.get_entry(dn, ['objectclass'])
|
||||
|
||||
# we need to extend object with ipaLocationMember objectclass
|
||||
@@ -253,7 +253,7 @@ class server_mod(LDAPUpdate):
|
||||
# server is not DNS server
|
||||
pass
|
||||
|
||||
if 'ipalocation_location' or 'ipalocationweight' in options:
|
||||
if 'ipalocation_location' or 'ipaserviceweight' in options:
|
||||
self.add_message(messages.ServiceRestartRequired(
|
||||
service=services.service('named').systemd_name,
|
||||
server=keys[0], ))
|
||||
|
||||
Reference in New Issue
Block a user