On Thu, Jan 29, 2009 at 1:12 PM, Michael DeHaan <mdehaan(a)redhat.com> wrote:
Jeff Schroeder wrote:
>
> On Thu, Jan 29, 2009 at 12:28 PM, Michael DeHaan <mdehaan(a)redhat.com>
> wrote:
>
>>
>> Jeff Schroeder wrote:
>>
>>>
>>> On Thu, Jan 29, 2009 at 11:44 AM, Michael DeHaan <mdehaan(a)redhat.com>
>>> wrote:
>>> ...snip...
>>>
>>>
>>>>>
>>>>> +# Loop until the ssh rpm is installed
>>>>> +if [ "$keys_found" = "yes" ]; then
>>>>> + while : ; do
>>>>> + sleep 10
>>>>> + if [ -d /mnt/sysimage/etc/ssh ] ; then
>>>>> + cp -f /tmp/ssh/ssh_host* /mnt/sysimage/etc/ssh/
>>>>> + logger "SSH-HOST-KEY copied to newly installed
system"
>>>>> + break
>>>>> + fi
>>>>> + done &
>>>>> +fi
>>>>> +#end
>>>>>
>>>>>
>>>>>
>>>>
>>>> Could the looping be eliminated by doing the top part in %pre and the
>>>> later
>>>> in %post?
>>>>
>>>> ex:
>>>>
>>>> %pre
>>>> $SNIPPET('preserve_ssh_host_keys_pre')
>>>>
>>>> %post
>>>> SNIPPET('preserve_ssh_host_keys_post')
>>>>
>>>>
>>>
>>> Splitting this up requires "%post nochroot" because /mnt/sysimage
>>> isn't available until after %pre. I am of the opinion "%post
nochroot"
>>> is more hacky than the alternative and chose not to do it this way on
>>> purpose. What do you think is better given the options? It also seems
>>> overly complicated to require %pre and %post sections when it can all
>>> be done in %pre.
>>>
>>>
>>
>> I think looping in Anaconda is kind of scary and wasn't really clear that
>> pre could loop infinitely.
>>
>
> I don't think this is a problem. If will only loop if it gets ssh keys
> off of the local box, and it is backgrounded. It would be killed after
> %post if it was looping forever.
>
>
>>
>> Also folks putting code below the loop might be suprised to see it delays
>> things. (In fact, I wasn't clear
>> %packages didn't wait for all pre sections to complete? Maybe I'm
>> skimming
>> this too fast).
>>
>
> You are most certainly skimming this too fast :-)
> The loop is backgrounded (done &) the installation continues. If the
> loop wasn't backgrounded the package install would never work. This is
> why an infinite loop won't matter. It will die when anaconda sends a
> reboot.
>
Ah, yeah, just busy -- what you have is then probably completely ok.
Ok great! Is there anything else I can do to make this more to your
liking or are you just going to put this in your patch queue?
>> Waiting until after the packages are installed (%post) seems
quite sane,
>> and
>> Anaconda does
>> support multiple %post sections. We could call the snippet
>> preserve_ssh_host_keys_post_nochroot if needed :)
>>
>>
>>>
>>> On the other hand I'm all for splitting this up if it is the
>>> difference between being included in upstream cobbler or not.
>>>
>>>
>>
>> Yeah let's do this.
>>
>
> *sigh* ok so here is a question. Should the user of this snippet be
> required to put a "%post nochroot" line, or should that be included
> inside of the post snippet towards the top?
>
Snippets should never include a section line like "%post" as it makes it
unclear when reading the kickstart. Have had some problems with user
confusion around that before
back when some snippets did that.
Noted.
--
Jeff Schroeder
Don't drink and derive, alcohol and analysis don't mix.
http://www.digitalprognosis.com