You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
duplicateThis is a duplicate of a closed or already existing issuestaleThis issue has had no recent or new discussion and will be forcefully closed in 1 month
There is lost of repetition in json files, templates (tpl), and autounattend.xml files.
Have you considered creating some script that would know about all the differences between different axes (see below) and be able to generate all these files?
The axes are:
A: windows version (7, 8, 8.1, 10, 2008, 2012, 2012r2 etc.)
B: windows edition (Pro, Enterprise, Standard, Web, Datacenter etc.)
C: platform (x86, x64)
D: winrm vs. ssh vs. cygwin
It feels like each axis presents a unique type of difference for all 3 types of files. It also feels like that the only significant differences are resulting from axis D (though I have not done a thorough look to verify this).
I was thinking there could be a script that would be passed parameters specifying value for each axis. It would then generate the .json template, the vagrant template in tpl, and Autounattend.xml.
These generated files could also be in the repository (e.g. to set up an automatic push to atlas in the future, or to make it easier to use for casual users) and in such case automated test (e.g. through Travis CI) could verify that all .json, .tpl and Autounattend.xml files committed to the repository are identical to the ones that would be generated from the script. I.e. development would really happen only inside this script, and before each commit, all files would be regenerated (but there could also be a variant where only the script is kept in the repository, not the .json, .tpl and Autounattend.xml files).
Current development effort is e.g. that if something needs to be changed for all ssh templates, then A×B×C modifications need to be made (which is tiresome and does lead to errors - as I just experienced in #48). With the script, only 1 modification would need to be made.
I was also thinking that maybe some of this could be achieved that there would be only one "universal" .json file, and all the differences would be expressed by variables passed to packer build, some of which would influence the packer template itself, and some of which would influence environment variables passed to provisioning scripts. The scripts run in VM would also be "universal" and use runtime detection and environment variables passed to them to do different things.
Finally, the Vagrantfiles in tpl are Ruby code, so maybe there could be some "library" of parameterized Ruby functions in one file which would then be used in the individual tpl templates, just with different parameters (but I am not sure whether such thing is possible in vagrant)?
OK, this is all that I had on my mind (sorry for the extensive braindump).
The text was updated successfully, but these errors were encountered:
These are great ideas. Despite having tweak-json.py, I personally have found jq significantly awesome for manipulating our json Packer templates. One issue I personally have w/ regards to fragmenting the templates or Autounattends, however, is that users won't be able to use the templates directly with Packer which requires having one of these languages to build them.
Although it might be beneficial to allow users to build their own templates from the 4 axes that you mentioned, I believe this to out of scope for this project.
Nonetheless, this issue seems to have gone stale. I've marked it as such, so unless anybody has any objections I'll close it in a month.
arizvisa
added
stale
This issue has had no recent or new discussion and will be forcefully closed in 1 month
duplicate
This is a duplicate of a closed or already existing issue
labels
Jan 5, 2020
duplicateThis is a duplicate of a closed or already existing issuestaleThis issue has had no recent or new discussion and will be forcefully closed in 1 month
DRY=Don't Repeat Yourself
There is lost of repetition in json files, templates (
tpl
), and autounattend.xml files.Have you considered creating some script that would know about all the differences between different axes (see below) and be able to generate all these files?
The axes are:
It feels like each axis presents a unique type of difference for all 3 types of files. It also feels like that the only significant differences are resulting from axis D (though I have not done a thorough look to verify this).
I was thinking there could be a script that would be passed parameters specifying value for each axis. It would then generate the .json template, the vagrant template in
tpl
, andAutounattend.xml
.These generated files could also be in the repository (e.g. to set up an automatic push to atlas in the future, or to make it easier to use for casual users) and in such case automated test (e.g. through Travis CI) could verify that all .json, .tpl and Autounattend.xml files committed to the repository are identical to the ones that would be generated from the script. I.e. development would really happen only inside this script, and before each commit, all files would be regenerated (but there could also be a variant where only the script is kept in the repository, not the .json, .tpl and Autounattend.xml files).
Current development effort is e.g. that if something needs to be changed for all
ssh
templates, then A×B×C modifications need to be made (which is tiresome and does lead to errors - as I just experienced in #48). With the script, only 1 modification would need to be made.I was also thinking that maybe some of this could be achieved that there would be only one "universal" .json file, and all the differences would be expressed by variables passed to packer build, some of which would influence the packer template itself, and some of which would influence environment variables passed to provisioning scripts. The scripts run in VM would also be "universal" and use runtime detection and environment variables passed to them to do different things.
Finally, the Vagrantfiles in
tpl
are Ruby code, so maybe there could be some "library" of parameterized Ruby functions in one file which would then be used in the individualtpl
templates, just with different parameters (but I am not sure whether such thing is possible in vagrant)?OK, this is all that I had on my mind (sorry for the extensive braindump).
The text was updated successfully, but these errors were encountered: