diff options
author | Martin Kosek <mkosek@redhat.com> | 2012-01-19 12:14:41 +0100 |
---|---|---|
committer | Martin Kosek <mkosek@redhat.com> | 2012-01-24 16:55:46 +0100 |
commit | 3f90f3fb26a714ecc2cb361faada9bd43394854c (patch) | |
tree | dcb3641c37ee6b86e740b411c33752a6eee30817 /ipalib | |
parent | 739217ed5b40c5b9c7ac7e8dc0e7434e0dd37994 (diff) | |
download | freeipa.git-3f90f3fb26a714ecc2cb361faada9bd43394854c.tar.gz freeipa.git-3f90f3fb26a714ecc2cb361faada9bd43394854c.tar.xz freeipa.git-3f90f3fb26a714ecc2cb361faada9bd43394854c.zip |
Mark optional DNS record parts
All DNS record part options in dnsrecord commands need to be
optional so that all of them are not required in every dnsrecord
command. However, FreeIPA API then does not include an information
which DNS record part options are optional in term of creating
a new DNS record. For example, LOC record option "latitude seconds"
is not needed to add a new LOC record.
This patch adds a flag "dnsrecord_optional" to all such options so
that this information is available for any other UI reading the
FreeIPA API.
https://fedorahosted.org/freeipa/ticket/2208
Diffstat (limited to 'ipalib')
-rw-r--r-- | ipalib/plugins/dns.py | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/ipalib/plugins/dns.py b/ipalib/plugins/dns.py index abb2e90b..da4934fc 100644 --- a/ipalib/plugins/dns.py +++ b/ipalib/plugins/dns.py @@ -401,13 +401,27 @@ class DNSRecord(Str): def get_parts(self): if self.parts is None: return tuple() - return tuple(part.clone_rename(self.part_name_format % (self.rrtype.lower(), part.name), - cli_name=self.cli_name_format % (self.rrtype.lower(), part.name), - label=self.part_label_format % (self.rrtype, unicode(part.label)), - required=False, - option_group=self.option_group_format % self.rrtype, - flags=(tuple(part.flags) + ('dnsrecord_part', 'virtual_attribute',))) \ - for part in self.parts) + + parts = [] + + for part in self.parts: + name = self.part_name_format % (self.rrtype.lower(), part.name) + cli_name = self.cli_name_format % (self.rrtype.lower(), part.name) + label = self.part_label_format % (self.rrtype, unicode(part.label)) + option_group = self.option_group_format % self.rrtype + flags = list(part.flags) + ['dnsrecord_part', 'virtual_attribute',] + + if not part.required: + flags.append('dnsrecord_optional') + + parts.append(part.clone_rename(name, + cli_name=cli_name, + label=label, + required=False, + option_group=option_group, + flags=flags)) + + return tuple(parts) def prompt_parts(self, backend, mod_dnsvalue=None): mod_parts = None |