[Freeipa-devel] [PATCH] [WIP] 172+173+175 Create per-type DNS API

Martin Kosek mkosek at redhat.com
Thu Dec 1 10:05:35 UTC 2011


On Mon, 2011-11-28 at 17:35 +0100, Martin Kosek wrote:
> I have prepared a working prototype of the new structured DNS API. It
> may still have rough edges (and unit tests are not ready), but it will
> provide a base for discussion and for WebUI folks - so that they can
> start development of the new DNS WebUI API.
> 
> The patch takes advantage of the DNS refactor I did in 172. For all
> supported non-DNSSEC RR types, the following commands are available:
> 
> dnsrecord<RRTYPE>-show ZONE NAME
> dnsrecord<RRTYPE>-add ZONE NAME
> dnsrecord<RRTYPE>-mod ZONE NAME VALUE
> 
> This is an example of the new API in action:
> 
> # ipa dnsrecord-show example.com foo
>   Record name: foo
>   A record: 10.0.0.1
> 
> # ipa dnsrecordmx-add example.com foo --exchanger="foo.example.com."
>   MX record: 0 foo.example.com.
>   Preference: 0
>   Exchanger: foo.example.com.
> ----------------------------
> Number of entries returned 1
> ----------------------------
> 
> # ipa dnsrecordmx-add example.com foo --preference=1 --exchanger="foo.example.com."
>   MX record: 0 foo.example.com.
>   Preference: 0
>   Exchanger: foo.example.com.
> 
>   MX record: 1 foo.example.com.
>   Preference: 1
>   Exchanger: foo.example.com.
> ----------------------------
> Number of entries returned 2
> ----------------------------
> 
> # ipa dnsrecordmx-show example.com foo
>   MX record: 0 foo.example.com.
>   Preference: 0
>   Exchanger: foo.example.com.
> 
>   MX record: 1 foo.example.com.
>   Preference: 1
>   Exchanger: foo.example.com.
> ----------------------------
> Number of entries returned 2
> ----------------------------
> 
> 
> There is an interactive wizard to help user modify a record without
> specifying an updated value first. If there is just one (MX) record, no
> wizard would be run.
> 
> # ipa dnsrecordmx-mod example.com foo --preference=2
> Which MX record would you like to modify?
> 
> [1]: 0 foo.example.com.
> [2]: 1 foo.example.com.
> 
> DNS record number: 2
>   MX record: 0 foo.example.com.
>   Preference: 0
>   Exchanger: foo.example.com.
> 
>   MX record: 2 foo.example.com.
>   Preference: 2
>   Exchanger: foo.example.com.
> ----------------------------
> Number of entries returned 2
> ----------------------------
> 
> # ipa dnsrecordmx-mod example.com foo "2 foo.example.com." --preference=3
>   MX record: 0 foo.example.com.
>   Preference: 0
>   Exchanger: foo.example.com.
> 
>   MX record: 3 foo.example.com.
>   Preference: 3
>   Exchanger: foo.example.com.
> ----------------------------
> Number of entries returned 2
> ----------------------------
> 
> 
> There are few open questions I am still thinking about:
> 
> 1) The commands return a list of structured records (just like *-find
> commands) instead of returning just one record. I thought that it may be
> more usable this way and consistent with dnsrecord-add/mod/show commands
> behavior which returns all records too. Otherwise, we would have to
> change the show command API and add VALUE argument, which would specify
> a value to be displayed:
> dnsrecord<RRTYPE>-show ZONE NAME VALUE
> 
> 2) Raw DNS record value is in the output too. I though it would be
> useful to see the raw DNS record value + its parts at one place.
> 
> 3) The commands are in format dnsrecord<RRTYPE>-cmd, for example
> dnsrecordmx-add. I think dnsrecord-mx-add may be more readable. If we
> want to go this way, I would have to bend the server framework a little
> which parses an LDAP object from the command name (LDAP object name is
> dnsrecordmx in this case). This is doable, although I am not sure if
> this does not have some implications in WebUI side.
> 
> Martin

I rebased both patches to the most recent master. Adding CSVs now works
ok again (with the fix in 175):

# ipa dnsrecord-mod example.com foo --a-rec=10.0.0.1,10.0.0.2
  Record name: foo
  A record: 10.0.0.1, 10.0.0.2

Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: freeipa-mkosek-172-3-rework-dnsrecord-processing.patch
Type: text/x-patch
Size: 96210 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/freeipa-devel/attachments/20111201/73404fa4/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: freeipa-mkosek-173-2-create-per-type-dns-api.patch
Type: text/x-patch
Size: 61661 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/freeipa-devel/attachments/20111201/73404fa4/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: freeipa-mkosek-175-fix-parameter-csv-parsing.patch
Type: text/x-patch
Size: 1319 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/freeipa-devel/attachments/20111201/73404fa4/attachment-0002.bin>


More information about the Freeipa-devel mailing list