Include file stubs in control xml
I have a need to include external xml stubs in my control xml. Ideally, these stubs will be generated during a pre-script, and later included for things like disk partitioning, package selection, X configuration, stuff like that. Basically I'm a Kickstart admin, and I've written a python script that examines a system and some install time arguments and generates the above things on the fly according to our internal formulas. I need to replicate this system for SUSE installs using autoyast. Is this possible? -- Jesse Keating RHCE Pogo Linux -- Linux Systems Engineer tel: (888) 828-7646 ex: 436
On Thu, Oct 07, 2004 at 01:25:15PM -0700, Jesse Keating wrote:
I have a need to include external xml stubs in my control xml. Ideally, these stubs will be generated during a pre-script, and later included for things like disk partitioning, package selection, X configuration, stuff like that.
Basically I'm a Kickstart admin, and I've written a python script that examines a system and some install time arguments and generates the above things on the fly according to our internal formulas. I need to replicate this system for SUSE installs using autoyast. Is this possible?
Hi Jesse, I think rules and classes could cover your needs: http://www.suse.de/~nashif/autoinstall/9.1/html/rulesandclass.html -- Martin Vidner, developer SuSE CR, s.r.o. e-mail: mvidner@suse.cz Drahobejlova 27 tel:+420-296542373 190 00 Praha 9, Czech Republic http://www.suse.cz
On Thu, Oct 07, 2004 at 01:25:15PM -0700, Jesse Keating wrote:
I have a need to include external xml stubs in my control xml. Ideally, these stubs will be generated during a pre-script, and later included for things like disk partitioning, package selection, X configuration, stuff like that.
Hi, I came to the conclusion that it is hard to check (a la xmlint) rule-based scripts as the rules get expanded at installation time. Another point that annoyed me was that the whole thing is basically one big xml-file which can be hard to edit. Although xml has the possibility to use include-directives it looked to me that it only works with absolute urls but not with relative. There is now also a new mechanism to include configuration files with the <location>-Tag iirc, but i suspect still not a relative path mechanism. Other point was that I did not really grasp how to get "classes" work. Thus I also tried the generator approach, generating the the configuration-data (on the fly) by a php-script running on the webserver (autoyast=http://..). As with php it is also easy possible to access databases, so it was not to hard to put the parameters of the hosts of the domain into a database. That php-script uses the ip-address it gets from the webserver as a key to access the data in the database. With php I could also make kind of templates for configuration-files containing php-tags which makes configuration quite compact and flexible. The rule-based thing i realized with a few if-diectives based on the parameter i get from the database. Another advantage was that the include-mechanism with php works with relative pathes. So now here the source for every a configuration file or script whether it is a php-template or not is just a seperate file. In order to xmllint easy the output of the php-install script I implemented a mode to start php-directly on the script-file where I pass the ip-address in question as parameter in. Two questions remain open to me. It would be nice to have a configurator to adapt configuration (cfengine or red carpet) after the installation which works on the basis of the same host parameter-data (database). Currently i don't do that. Second one is one has to get some parameters of hosts in advance. There are other possible limitations with that textbased configuration script. I don't see a mechanism to quote directly xml- or php-like tags in files. Other experiences I made. It is impossible to create easely a configuration files of size zero bytes with the <files> mechanism (except with script), It is impossible with the <files> mechanism to run only a script on a file but not to put some data in advance into it. It is impossible trivially to create a configuration file at a place where the directory has to be created in advance. Am I wrong? Greetings, David
Basically I'm a Kickstart admin, and I've written a python script that examines a system and some install time arguments and generates the above things on the fly according to our internal formulas. I need to replicate this system for SUSE installs using autoyast. Is this possible?
-- Jesse Keating RHCE Pogo Linux -- Linux Systems Engineer tel: (888) 828-7646 ex: 436
-- To unsubscribe, e-mail: suse-autoinstall-unsubscribe@suse.com For additional commands, e-mail: suse-autoinstall-help@suse.com
On Thursday 07 October 2004 22:25, Jesse Keating wrote:
I have a need to include external xml stubs in my control xml. Ideally, these stubs will be generated during a pre-script, and later included for things like disk partitioning, package selection, X configuration, stuff like that.
Basically I'm a Kickstart admin, and I've written a python script that examines a system and some install time arguments and generates the above things on the fly according to our internal formulas. I need to replicate this system for SUSE installs using autoyast. Is this possible?
Yes. Use a different <profile> tag: ----8<----8<----8<---- <?xml version="1.0"?> <!DOCTYPE profile SYSTEM "/usr/share/autoinstall/dtd/profile.dtd"> <profile xmlns="http://www.suse.com/1.0/yast2ns" xmlns:config="http://www.suse.com/1.0/configns" xmlns:xinclude="http://www.w3.org/2001/XInclude"> <configure> <scripts> <post-scripts config:type="list"> <xinclude:include href="http://10.0.0.2/pub/suse/profiles/inc.10.0.0/mk-root-mc-ini.sh.xml" /> </post-scripts> </scripts> </configure> </profile> ---->8---->8---->8---- Here's an example of an include file: ----8<----8<----8<---- <script> <filename>mk-root-mc-ini.sh</filename> <interpreter>shell</interpreter> <source> <![CDATA[ mkdir -p /root/.mc && cat > /root/.mc/ini <<EOF [Midnight-Commander] navigate_with_arrows=1 [New Left Panel] list_mode=user user_format=half type,name,|,size,|,mtime,|,perm,|,owner,|,group [New Right Panel] list_mode=user user_format=half type,name,|,size,|,mtime,|,perm,|,owner,|,group EOF cp -a /root/.mc /etc/skel/ ]]> </source> </script> ---->8---->8---->8---- NOTE: There is a catch. If you edit the xml file, autoyast automatically includes the include file. If you subsequently save the xms file, then the line with <xinclude:include ...> is *replaced* with the actual contents of the include file. Cheers, Leen
On Friday 08 October 2004 04:35, Leendert Meyer wrote:
NOTE: There is a catch. If you edit the xml file, autoyast automatically includes the include file. If you subsequently save the xms file, then the line with <xinclude:include ...> is *replaced* with the actual contents of the include file.
Thats pretty close to what I need. Let me try and clarify. I need to run a script in <pre-scripts>. This script could be external, probably should for sanity sake. This script will examine parts of the system using the Linux environment (and maybe some python source files from anaconda) and based up on that dump out to the ramdisk some files (which can be xml formatted for autoyast compatibility). I wish to INCLUDE these files further down for information such as disk formatting/partitioning, package selection, Xconfiguration, runlevel config, etc... This would allow me to have ONE control file that will generate dynamic information each time it is used for each type of system I use it against. Again, this works in kickstart, will it work in autoyast? I think the main questions are: A) When SUSE starts autoyast and reads the control file, does it include all files at exactly that time, BEFORE running any <pre-scripts> ? B) If I can run scripts before all the inclusion, can I include files that are written to the local ramdisk? -- Jesse Keating RHCE Pogo Linux -- Linux Systems Engineer tel: (888) 828-7646 ex: 436
On Friday 08 October 2004 18:35, Jesse Keating wrote:
On Friday 08 October 2004 04:35, Leendert Meyer wrote:
NOTE: There is a catch. If you edit the xml file, autoyast automatically includes the include file. If you subsequently save the xms file, then the line with <xinclude:include ...> is *replaced* with the actual contents of the include file.
Thats pretty close to what I need. Let me try and clarify.
I need to run a script in <pre-scripts>. This script could be external, probably should for sanity sake. This script will examine parts of the system using the Linux environment (and maybe some python source files from anaconda) and based up on that dump out to the ramdisk some files (which can be xml formatted for autoyast compatibility). I wish to INCLUDE these files further down for information such as disk formatting/partitioning, package selection, Xconfiguration, runlevel config, etc...
I think your goal would be served by rules. Rules allow certain decisions to be made. Martin Vidner already gave you a good pointer.
This would allow me to have ONE control file that will generate dynamic information each time it is used for each type of system I use it against. Again, this works in kickstart, will it work in autoyast?
I think the main questions are:
A) When SUSE starts autoyast and reads the control file, does it include all files at exactly that time, BEFORE running any <pre-scripts> ?
IIRC, right after the xml control file is read, the include files are read. So the answer is yes.
B) If I can run scripts before all the inclusion,
AFAIK, you can't.
can I include files that are written to the local ramdisk?
Sorry, can't answer this question. Perhaps Anas can? ---- But, assuming you serve the xml include files from a web server, it does not matter where the include files come from. The actual content could be dynamically generated by a php script, or a perl script running on the server. Perhaps you can even pass cgi arguments to the script. Cheers, Leen
On Friday 08 October 2004 12:02, Leendert Meyer wrote:
I think your goal would be served by rules. Rules allow certain decisions to be made. Martin Vidner already gave you a good pointer.
Well, rules allow me to use a set of pre-determined assumptions. However this is not flexible enough, nor do I want to manage 50 differnet stub files to work with my 50 different possible disk configurations. Is there something outSIDE of autoyast that might let me do what I'm trying to do? -- Jesse Keating RHCE Pogo Linux -- Linux Systems Engineer tel: (888) 828-7646 ex: 436
Jesse Keating wrote:
On Friday 08 October 2004 04:35, Leendert Meyer wrote:
NOTE: There is a catch. If you edit the xml file, autoyast automatically includes the include file. If you subsequently save the xms file, then the line with <xinclude:include ...> is *replaced* with the actual contents of the include file.
Thats pretty close to what I need. Let me try and clarify.
I need to run a script in <pre-scripts>. This script could be external, probably should for sanity sake. This script will examine parts of the system using the Linux environment (and maybe some python source files from anaconda) and based up on that dump out to the ramdisk some files (which can be xml formatted for autoyast compatibility). I wish to INCLUDE these files further down for information such as disk formatting/partitioning, package selection, Xconfiguration, runlevel config, etc... This would allow me to have ONE control file that will generate dynamic information each time it is used for each type of system I use it against. Again, this works in kickstart, will it work in autoyast?
I think the main questions are:
A) When SUSE starts autoyast and reads the control file, does it include all files at exactly that time, BEFORE running any <pre-scripts> ?
Right.
B) If I can run scripts before all the inclusion, can I include files that are written to the local ramdisk?
There is a feature to do just that, that I never tested or documented, you can try it :-) After the file has been parsed, it is always copied to /tmp/profile/autoinst.xml This file can be used as the basis for manipulation. It would have all classes and results from rules, additionaly it will have any external includes. After the pre scripts are executed, autoyast looks for the file: /tmp/profile/modified.xml This file can be put there by the some script. If the file exists, it will be read and used for further processing. I guess this is what you want, right? Anas
On Sunday 10 October 2004 17:54, Anas Nashif wrote:
There is a feature to do just that, that I never tested or documented, you can try it :-)
After the file has been parsed, it is always copied to
/tmp/profile/autoinst.xml
This file can be used as the basis for manipulation. It would have all classes and results from rules, additionaly it will have any external includes.
After the pre scripts are executed, autoyast looks for the file:
/tmp/profile/modified.xml
This file can be put there by the some script. If the file exists, it will be read and used for further processing.
I guess this is what you want, right?
Thanks! I think this will do exactly what I need it to do. -- Jesse Keating RHCE Pogo Linux -- Linux Systems Engineer tel: (888) 828-7646 ex: 436
On Oct 10, 2004, at 5:54 PM, Anas Nashif wrote:
After the pre scripts are executed, autoyast looks for the file:
/tmp/profile/modified.xml
This file can be put there by the some script. If the file exists, it will be read and used for further processing.
Ok, I'm having some difficulty with modified.xml. Is there anywhere that documents what the syntax should be for this file? I've added in here stanzas for disk partitioning, X config, and package selection, however I continually get a message saying that the device doesn't exist on my system ( even though the device DOES (hda) ). Any help would be greatly appreciated. -- Jesse Keating RHCE Pogo Linux -- Linux Systems Engineer tel: (888) 828-7646 ex: 436
Jesse Keating wrote:
On Oct 10, 2004, at 5:54 PM, Anas Nashif wrote:
After the pre scripts are executed, autoyast looks for the file:
/tmp/profile/modified.xml
This file can be put there by the some script. If the file exists, it will be read and used for further processing.
Ok, I'm having some difficulty with modified.xml. Is there anywhere that documents what the syntax should be for this file?
This should have just the same syntax as any profile.
I've added in here stanzas for disk partitioning, X config, and package selection, however I continually get a message saying that the device doesn't exist on my system ( even though the device DOES (hda) ). Any help would be greatly appreciated.
Can you send me the y2log files? Anas
On Thursday 14 October 2004 17:01, Anas Nashif wrote:
This should have just the same syntax as any profile.
I've added in here stanzas for disk partitioning, X config, and package selection, however I continually get a message saying that the device doesn't exist on my system ( even though the device DOES (hda) ). Any help would be greatly appreciated.
Can you send me the y2log files?
I cleared this up. I was using <device>hda</device> once my script variables expanded instead of <device>/dev/hda</device>. Silly me. However, one thing remains. Documentation speaks of a possible <use> value to reuse all Linux partitions, and digging through the autoyast2 source for SUSE Pro 9.1, one can grok that this is <use>linux</use> however when I attempt this on SLES9, I get the error message that no free space is left on the device. Is 'linux' not a valid option for SLES9? Honestly it'll probably only be a factor on SUSE Pro 9.1, not many people are going to dualboot windows with SLES, however I would like to have it be the same across both systems. -- Jesse Keating RHCE Pogo Linux -- Linux Systems Engineer tel: (888) 828-7646 ex: 436
participants (5)
-
Anas Nashif
-
David Werner
-
Jesse Keating
-
Leendert Meyer
-
Martin Vidner