[Freeipa-devel] [PATCH 017] certprofile-import: do not require profileId in profile data

Martin Basti mbasti at redhat.com
Fri Jul 31 14:01:59 UTC 2015


On 30/07/15 12:44, Christian Heimes wrote:
> On 2015-07-24 12:41, Martin Basti wrote:
>> On 24/07/15 05:15, Fraser Tweedale wrote:
>>>> diff --git a/ipalib/plugins/certprofile.py b/ipalib/plugins/certprofile.py
>>>> index 5550ed942521dbab2e783fba1570520268f9b378..fe8934690fe09499f0bacb6610d9815a2b4367a4 100644
>>>> --- a/ipalib/plugins/certprofile.py
>>>> +++ b/ipalib/plugins/certprofile.py
>>>> @@ -233,8 +233,8 @@ class certprofile_import(LDAPCreate):
>>>>   
>>>>           match = self.PROFILE_ID_PATTERN.search(options['file'])
>>>>           if match is None:
>>>> -            raise errors.ValidationError(name='file',
>>>> -                error=_("Profile ID is not present in profile data"))
>>>> +            # no profileId found, use CLI value as profileId.
>>>> +            options['file'] = u'profileId=%s\n%s' % (keys[0], options['file'])
>>> NACK
>>>
>>> This assignment has no external effect; `post_callback' is called
>>> with original `options['file']' and dogtag profile import can fail
>>> due to missing profileId.
>>>
>>> The solution is to do the same thing in post_callback; updated patch
>>> attached.
>>>
>>> Thanks,
>>> Fraser
>>>
>>>
>> I dont like to have the same code twice in pre and post callback.
>>
>> Can you use contexmanager to store the right value in pre callback and
>> then use it in post callback?
>> (can find it in dns plugin, search for context)
>
> Sounds good to me!
>
> Christian
>
> PS: Context is a fancy name for a TLS dict. ;)
ACK

Pushed to:
master: a4ade199aa594307cdd6bc43d1729cc42e92fd1e
ipa-4-2: d80e90fa5c5ad41f5f29a02c11bca7c7da269938


-- 
Martin Basti




More information about the Freeipa-devel mailing list