[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: How to modify a single attribute from multiple list of attributes



Thanks to everyone who replied. In my searching, I hadn't found any examples of modifying an attribute that had multiple values. the following ldif did exactly what I needed:
    dn: cn=config,o=dhcp
    changetype: modify
    delete: dhcpStatements
    dhcpStatements: log-facility local7
    -
    add: dhcpStatements
    dhcpStatements: log-facility local3

I was stuck on trying to use 'replace' rather then 'delete + add' and I couldn't find an ldif syntax that worked.

Thanks again!
Tom Leach

On 07/02/2010 04:24 PM, Tom Leach wrote:
How do I modify/delete a single attribute from the directory when I have multiple attributes of the same name.
For example, given the following ldif:
    dn: cn=config,o=dhcp
    cn: config
    objectClass: top
    objectClass: dhcpService
    objectClass: dhcpOptions
    dhcpPrimaryDN: cn=server1,o=dhcp
    dhcpStatements: default-lease-time 600
    dhcpStatements: max-lease-time 1200
    dhcpStatements: ddns-update-style none
    dhcpStatements: boot-unknown-clients on
    dhcpStatements: log-facility local7

How would I modify just one of the dhcpStatements: attributes, for example, change 'dhcpStatements: log-facility local7' to 'dhcpStatements: log-facility local3'?

I've tried an ldif with:
    dn: cn=config,o=dhcp
    changetype: modify
    replace: dhcpStatements log-facility local7
    dhcpStatements: log-facility local3
But that just gave me an error:
    ldapmodify: Undefined attribute type (17)  additional info:
    dhcpStatements log-facility local7: AttributeDescription
    contains inappropriate characters.

I've also tried:
    dn: cn=config,o=dhcp
    changetype: modify
    replace: dhcpStatements
    dhcpStatements: log-facility local3
But that just gave me an error:
    replace modify:
        dhcpStatements
    replace dhcpStatements:
        log-facility local3
    modifying entry "cn=config,o=dhcp"
    modify complete
    ldapmodify: Undefined attribute type (17)
        additional info: modify: attribute type undefined

I can use 'delete: dhcpStatements' but that deletes all of the dhcpStatements and then I have to add all of them back with the modification to the one that's needed.

So, what ldapmodify/ldif syntax is needed to specify which of multiple attributes should be modified?
Thanks!
Tom Leach