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:
Martin Basti
2016-06-16 19:13:45 +02:00
parent 3c50e42036
commit 4155eb7b13
11 changed files with 36 additions and 36 deletions

View File

@@ -239,7 +239,7 @@ aci: (targetattr = "accesstime || cn || createtimestamp || description || entryu
dn: cn=usermap,cn=selinux,dc=ipa,dc=example
aci: (targetfilter = "(objectclass=ipaselinuxusermap)")(version 3.0;acl "permission:System: Remove SELinux User Maps";allow (delete) groupdn = "ldap:///cn=System: Remove SELinux User Maps,cn=permissions,cn=pbac,dc=ipa,dc=example";)
dn: cn=masters,cn=ipa,cn=etc,dc=ipa,dc=example
aci: (targetattr = "cn || createtimestamp || entryusn || ipalocation || ipalocationweight || modifytimestamp || objectclass")(targetfilter = "(objectclass=ipaConfigObject)")(version 3.0;acl "permission:System: Read Locations of IPA Servers";allow (compare,read,search) groupdn = "ldap:///cn=System: Read Locations of IPA Servers,cn=permissions,cn=pbac,dc=ipa,dc=example";)
aci: (targetattr = "cn || createtimestamp || entryusn || ipalocation || ipaserviceweight || modifytimestamp || objectclass")(targetfilter = "(objectclass=ipaConfigObject)")(version 3.0;acl "permission:System: Read Locations of IPA Servers";allow (compare,read,search) groupdn = "ldap:///cn=System: Read Locations of IPA Servers,cn=permissions,cn=pbac,dc=ipa,dc=example";)
dn: cn=masters,cn=ipa,cn=etc,dc=ipa,dc=example
aci: (targetattr = "cn || createtimestamp || entryusn || ipaconfigstring || modifytimestamp || objectclass")(targetfilter = "(objectclass=ipaConfigObject)")(version 3.0;acl "permission:System: Read Status of Services on IPA Servers";allow (compare,read,search) groupdn = "ldap:///cn=System: Read Status of Services on IPA Servers,cn=permissions,cn=pbac,dc=ipa,dc=example";)
dn: cn=services,cn=accounts,dc=ipa,dc=example

View File

@@ -4200,7 +4200,7 @@ option: Str('addattr*', cli_name='addattr')
option: Flag('all', autofill=True, cli_name='all', default=False)
option: Str('delattr*', cli_name='delattr')
option: DNSNameParam('ipalocation_location?', autofill=False, cli_name='location')
option: Int('ipalocationweight?', autofill=False, cli_name='location_weight')
option: Int('ipaserviceweight?', autofill=False, cli_name='service_weight')
option: Flag('no_members', autofill=True, default=False)
option: Flag('raw', autofill=True, cli_name='raw', default=False)
option: Flag('rights', autofill=True, default=False)

View File

@@ -90,5 +90,5 @@ IPA_DATA_VERSION=20100614120000
# #
########################################################
IPA_API_VERSION_MAJOR=2
IPA_API_VERSION_MINOR=186
# Last change: mbasti - added dnsserver-* commands
IPA_API_VERSION_MINOR=187
# Last change: mbasti - rename ipalocationweight to ipaserviceweight

View File

@@ -75,7 +75,7 @@ attributeTypes: ( 2.16.840.1.113730.3.8.5.30 NAME 'idnsSubstitutionVariable' DES
attributeTypes: ( 2.16.840.1.113730.3.8.11.74 NAME 'ipaDNSVersion' DESC 'IPA DNS data version' EQUALITY integerMatch ORDERING integerOrderingMatch SINGLE-VALUE SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 X-ORIGIN 'IPA v4.3' )
attributeTypes: ( 2.16.840.1.113730.3.8.5.31 NAME 'idnsServerId' DESC 'DNS server identifier' EQUALITY caseIgnoreMatch SINGLE-VALUE SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'IPA v4.4' )
attributeTypes: ( 2.16.840.1.113730.3.8.5.32 NAME 'ipaLocation' DESC 'Reference to IPA location' EQUALITY distinguishedNameMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 SINGLE-VALUE X-ORIGIN 'IPA v4.4' )
attributeTypes: ( 2.16.840.1.113730.3.8.5.33 NAME 'ipaLocationWeight' DESC 'Weight for the server in IPA location' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE X-ORIGIN 'IPA v4.4' )
attributeTypes: ( 2.16.840.1.113730.3.8.5.33 NAME 'ipaServiceWeight' DESC 'Weight for the server in IPA location' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE X-ORIGIN 'IPA v4.4' )
objectClasses: ( 2.16.840.1.113730.3.8.6.0 NAME 'idnsRecord' DESC 'dns Record, usually a host' SUP top STRUCTURAL MUST idnsName MAY ( cn $ idnsAllowDynUpdate $ dNSTTL $ dNSClass $ aRecord $ aAAARecord $ a6Record $ nSRecord $ cNAMERecord $ pTRRecord $ sRVRecord $ tXTRecord $ mXRecord $ mDRecord $ hInfoRecord $ mInfoRecord $ aFSDBRecord $ SigRecord $ KeyRecord $ LocRecord $ nXTRecord $ nAPTRRecord $ kXRecord $ certRecord $ dNameRecord $ dSRecord $ sSHFPRecord $ rRSIGRecord $ nSECRecord $ DLVRecord $ TLSARecord $ UnknownRecord $ RPRecord $ APLRecord $ IPSECKEYRecord $ DHCIDRecord $ HIPRecord $ SPFRecord ) )
objectClasses: ( 2.16.840.1.113730.3.8.6.1 NAME 'idnsZone' DESC 'Zone class' SUP idnsRecord STRUCTURAL MUST ( idnsZoneActive $ idnsSOAmName $ idnsSOArName $ idnsSOAserial $ idnsSOArefresh $ idnsSOAretry $ idnsSOAexpire $ idnsSOAminimum ) MAY ( idnsUpdatePolicy $ idnsAllowQuery $ idnsAllowTransfer $ idnsAllowSyncPTR $ idnsForwardPolicy $ idnsForwarders $ idnsSecInlineSigning $ nSEC3PARAMRecord ) )
objectClasses: ( 2.16.840.1.113730.3.8.6.2 NAME 'idnsConfigObject' DESC 'DNS global config options' STRUCTURAL MAY ( idnsForwardPolicy $ idnsForwarders $ idnsAllowSyncPTR $ idnsZoneRefresh $ idnsPersistentSearch ) )
@@ -86,4 +86,4 @@ objectClasses: ( 2.16.840.1.113730.3.8.6.5 NAME 'idnsTemplateObject' DESC 'Templ
objectClasses: ( 2.16.840.1.113730.3.8.12.36 NAME 'ipaDNSContainer' DESC 'IPA DNS container' AUXILIARY MUST ( ipaDNSVersion ) X-ORIGIN 'IPA v4.3' )
objectClasses: ( 2.16.840.1.113730.3.8.6.6 NAME 'idnsServerConfigObject' DESC 'DNS server configuration options' STRUCTURAL MUST ( idnsServerId ) MAY ( idnsSubstitutionVariable $ idnsSOAmName $ idnsForwarders $ idnsForwardPolicy ) X-ORIGIN 'IPA v4.4' )
objectClasses: ( 2.16.840.1.113730.3.8.6.7 NAME 'ipaLocationObject' DESC 'Object for storing IPA server location' STRUCTURAL MUST ( idnsName ) MAY ( description ) X-ORIGIN 'IPA v4.4' )
objectClasses: ( 2.16.840.1.113730.3.8.6.8 NAME 'ipaLocationMember' DESC 'Member object of IPA location' AUXILIARY MAY ( ipaLocation $ ipaLocationWeight ) X-ORIGIN 'IPA v4.4' )
objectClasses: ( 2.16.840.1.113730.3.8.6.8 NAME 'ipaLocationMember' DESC 'Member object of IPA location' AUXILIARY MAY ( ipaLocation $ ipaServiceWeight ) X-ORIGIN 'IPA v4.4' )

View File

@@ -239,7 +239,7 @@ return {
flags: ['w_if_no_aci']
},
{
name: 'ipalocationweight',
name: 'ipaserviceweight',
placeholder: '100'
},
{
@@ -412,10 +412,10 @@ return {
link: true
},
{
name: 'ipalocationweight'
name: 'ipaserviceweight'
},
{
name: 'location_relative_weight'
name: 'service_relative_weight'
}
]
}
@@ -586,7 +586,7 @@ topology.location_association_table_widget = function(spec) {
},
{
$type: 'text',
name: 'ipalocationweight'
name: 'ipaserviceweight'
}
]
}

View File

@@ -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', ()))

View File

@@ -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

View File

@@ -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], ))

View File

@@ -177,11 +177,11 @@ class TestLocationsServer(XMLRPC_test):
server.update(
dict(
ipalocation_location=location.idnsname_obj,
ipalocationweight=200,
ipaserviceweight=200,
),
expected_updates=dict(
ipalocation_location=[location.idnsname_obj],
ipalocationweight=[u'200'],
ipaserviceweight=[u'200'],
)
)
# remove invalid data from the previous test
@@ -195,6 +195,6 @@ class TestLocationsServer(XMLRPC_test):
location.remove_server_from_location(server.server_name)
location.retrieve()
def test_remove_location_weight_from_server(self, location, server):
server.update(dict(ipalocationweight=None))
def test_remove_service_weight_from_server(self, location, server):
server.update(dict(ipaserviceweight=None))
location.retrieve()

View File

@@ -132,8 +132,8 @@ class LocationTracker(Tracker):
self.attrs.setdefault('servers_server', []).append(server_name)
self.servers[server_name] = {
'cn': [server_name],
'ipalocationweight': [unicode(weight)],
'location_relative_weight': [relative_weight]
'ipaserviceweight': [unicode(weight)],
'service_relative_weight': [relative_weight]
}
def remove_server_from_location(self, server_name):

View File

@@ -13,18 +13,18 @@ class ServerTracker(Tracker):
retrieve_keys = {
'cn', 'dn', 'ipamaxdomainlevel', 'ipamindomainlevel',
'iparepltopomanagedsuffix_topologysuffix', 'ipalocation_location',
'ipalocationweight',
'ipaserviceweight',
}
retrieve_all_keys = retrieve_keys | {'objectclass'}
create_keys = retrieve_keys | {'objectclass'}
find_keys = {
'cn', 'dn', 'ipamaxdomainlevel', 'ipamindomainlevel',
'ipalocationweight',
'ipaserviceweight',
}
find_all_keys = retrieve_all_keys
update_keys = {
'cn', 'ipamaxdomainlevel', 'ipamindomainlevel',
'ipalocation_location', 'ipalocationweight',
'ipalocation_location', 'ipaserviceweight',
}
def __init__(self, name):