Bug 1196885 - init-scripts relurl downloaded multiple times, the last one using wrong base
init-scripts relurl downloaded multiple times, the last one using wrong base
Status: CONFIRMED
Classification: openSUSE
Product: openSUSE Tumbleweed
Classification: openSUSE
Component: AutoYaST
Current
Other Other
: P5 - None : Normal (vote)
: ---
Assigned To: YaST Team
E-mail List
https://trello.com/c/bFxxRzR8
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2022-03-08 20:15 UTC by Luiz Angelo Daros de Luca
Modified: 2022-03-09 15:00 UTC (History)
1 user (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
y2logs (3.45 MB, application/x-xz)
2022-03-08 20:15 UTC, Luiz Angelo Daros de Luca
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Luiz Angelo Daros de Luca 2022-03-08 20:15:18 UTC
Created attachment 856849 [details]
y2logs

Hello,

This simple init-script call:

  <scripts>
    <init-scripts config:type="list">
      <script>
        <filename>myscript.sh</filename>
        <location><![CDATA[relurl://../repo/myscript.txt]]></location>
      </script>
    </init-scripts
  </scripts>

Fails to work. First it was resolved 4 times, downloaded twice (I believe before and after the boot) and the last time using a different base name (not related to autoyast).

y2log-1.gz:2022-03-08 15:55:50 <1> testinstall(4575) [Ruby] autoinstall/script.rb(resolve_location):167 resolved location "http://myrepo.com/suse/opensuse-tumbleweed/oss/../autoyast/../repo/myscript.txt"
y2log-1.gz:2022-03-08 15:55:54 <1> testinstall(4575) [Ruby] autoinstall/script.rb(resolve_location):167 resolved location "http://myrepo.com/suse/opensuse-tumbleweed/oss/../autoyast/../repo/myscript.txt"
y2log-1.gz:2022-03-08 15:55:54 <1> testinstall(4575) [Ruby] autoinstall/script.rb(resolve_location):167 resolved location "http://myrepo.com/suse/opensuse-tumbleweed/oss/../autoyast/../repo/myscript.txt"
y2log-1.gz:2022-03-08 16:25:55 <1> testinstall(4575) [agent-curl] CurlAgent.cc(Execute):270 Output: /mnt/var/adm/autoinstall/init.d/myscript.sh
y2log:2022-03-08 16:37:13 <1> testinstall(3742) [Ruby] autoinstall/script.rb(resolve_location):167 resolved location "http://myrepo.com/suse/opensuse-tumbleweed/oss/../../repo/myscript.txt"
y2log:2022-03-08 16:37:13 <1> testinstall(3742) [agent-curl] CurlAgent.cc(Execute):270 Output: /var/adm/autoinstall/init.d/myscript.sh

The last time it executed, autoyast chomped the autoyast/ form URL, changing the file location from http://myrepo.com/suse/opensuse-tumbleweed/repo/myscript.txt to http://myrepo.com/suse/repo/myscript.txt. My guess is that autoyast is unconditionally removing the autoyast file, not considering it might not be explicitly mentioned (I'm using .../autoyast/[default])

I'm using this kernel cmdline args: install=http://myrepo.com/suse/opensuse-tumbleweed/oss/ AutoYaST=relurl://../autoyast/

Yast logs attached.

It affects at least since 15.3 up to tumbleweed 20220306 (and probably 15.4)
Comment 1 Ancor Gonzalez Sosa 2022-03-09 11:25:58 UTC
(In reply to Luiz Angelo Daros de Luca from comment #0)
> <location><![CDATA[relurl://../repo/myscript.txt]]></location>

Looking at the attached logs, looks like that line was correctly interpreted by AutoYaST so its format shouldn't be the root of the problem. Having said that, shouldn't it be simply like this?

> <location>relurl://../repo/myscript.txt</location>

From what I can see in the AutoYaST documentation, the cdata tag is only needed to embed a script (ie. using "source") and not to provide an url (ie. using "location").
Comment 2 Ancor Gonzalez Sosa 2022-03-09 11:27:03 UTC
(In reply to Ancor Gonzalez Sosa from comment #1)
> 
> From what I can see in the AutoYaST documentation [...]

Here, I meant: https://documentation.suse.com/sles/15-SP3/single-html/SLES-autoyast/index.html#init-scripts
Comment 3 Ancor Gonzalez Sosa 2022-03-09 15:00:27 UTC
(In reply to Luiz Angelo Daros de Luca from comment #0)
> 
> The last time it executed, autoyast chomped the autoyast/ form URL, changing
> the file location from
> http://myrepo.com/suse/opensuse-tumbleweed/repo/myscript.txt to
> http://myrepo.com/suse/repo/myscript.txt. My guess is that autoyast is
> unconditionally removing the autoyast file, not considering it might not be
> explicitly mentioned (I'm using .../autoyast/[default])

No, that's not the cause for the incorrect chopping. The difference is here:

https://github.com/yast/yast-autoinstallation/blob/4e8a7f5/src%2Flib%2Fautoinstall%2Fscript.rb#L158

Apparently during first stage (before the system reboots) that condition is being evaluated to false because the value of Yast::AutoinstConfig.scheme is already resolved. But in the second stage that's not the case and the url of the script is computed differently (not to say wrongly).