salt icon indicating copy to clipboard operation
salt copied to clipboard

Extend Salt Windows Package Manager to Multiple Source Files

Open dimm037 opened this issue 12 years ago • 8 comments

It would be nice to have the Salt Windows package manager support installers that are broken up into multiple files as in the case with disk spanning that is generally made up of a single .exe with multiple .bin files.

This would also be helpful in situations where the installer comes from a CD/DVD, e.g. Visual Studio, that is typically made up of one or more .exe or .msi and a number of .cab and configuration files.

It would be nice to do the following in a Windows package manager definition file:

  • Specify a directory that contains all the installer components, where it would be copied to an appropriate location in the minion cache.
  • Specify one or more installers (either .exe or .msi) along with arguments to invoke in a sequential order.
  • Specify one or more un-installers (either .exe or .msi) along with arguments to invoke in a sequential order.

The installers and un-installers would be in a location relative to where it's copied to on the minion.

dimm037 avatar Dec 04 '13 19:12 dimm037

Sounds like these would be very useful features to have! Thanks for the request!

basepi avatar Dec 04 '13 20:12 basepi

I would also like to have this feature. Innosetup doesn't allow single file installers larger than 2G.

gtmacdonald avatar Mar 26 '14 01:03 gtmacdonald

I'm working around this problem (at least partially) for now by syncing the files to the Minion as long as the package isn't installed yet:

office-installer-files:
    {% if 'microsoft.office' in salt['pkg.list_pkgs']() %}
        file.absent:
            - name: c:\salt\var\cache\salt\minion\files\base\win\repo\microsoft\office\2013
    {% else %}
        file.recurse:
            - name: c:\salt\var\cache\salt\minion\files\base\win\repo\microsoft\office\2013
            - source: salt://win/repo/microsoft/office/2013
    {% endif %}

microsoft.office:
    pkg:
        - installed
        - require:
            - file: office-installer-files

That's surely not really beautiful as it requires adapting the paths as the package versions change, but at least does it work properly for now.

Thanks a lot @whiteinge for suggesting to wrap the file-syncing in an if block to have the files only cached as long as the package isn't installed.

eliasp avatar Mar 28 '14 21:03 eliasp

That's interesting, I was using module.run with cp.cache_dir instead of file.recurse but it doesn't have the cache cleanup feature. Thx.

gtmacdonald avatar Mar 28 '14 22:03 gtmacdonald

Hi , I am getting below error while trying to execute this above sls file with command .

#salt-run winrepo.genrepo

Error below :+1:

[ERROR ] An un-handled exception was caught by salt's global exception handler: ScannerError: while scanning for the next token found character '%' that cannot start any token in "", line 2, column 6: {% if 'microsoft.office' in salt[ ...

shyamrkg avatar Nov 18 '14 07:11 shyamrkg

@shyamrkg It looks like you're using Jinja in your winrepo definitions. This is not (yet) supported (see #6859). The Jinja-containing lines I described above are part of a state file.

eliasp avatar Nov 18 '14 14:11 eliasp

@eliasp Would you mind sharing your winrepo definition for the microsoft.office package so I can see how it plays together with the state file? I didn't see it in the salt-winrepo project... I'm guessing you reference the local cache path from the state file in the 'installer' property? Is there anything particularly special about the path you selected, or the directories in that path?

lorengordon avatar Jan 08 '15 19:01 lorengordon

@lorengordon As this is just a rather hackish workaround, I didn't want to add it to the salt-winrepo project as it requires manual intervention and can only be used through an SLS, but not through the usual pkg.install mechanisms.

In my win_repo I have: microsoft/office/init.sls:

microsoft.office:
    15.0.4420.1017: # 2013
        installer: salt://win/repo/microsoft/office/2013/setup.exe
        full_name: Microsoft Office Professional Plus 2013
        reboot: False
        install_flags: ' /adminfile microsoft.office.2013.msp'
        msiexec: False
        uninstaller: salt://win/repo/microsoft/office/2013/setup.exe
        uninstall_flags: ' /uninstall'

I'm using the /adminfile param to pre-define some environment specific installation parameters (licensing) and to to enable the unattended mode of the installer. The MSP was created using the Microsoft Office Customization Tool, but there might be other approaches to run the installer in unattended mode too.

For dealing now with the fact, that Salt can't handle win_repo software yet which requires more than the file to which installer points, I'm using the following SLS in which office_version is set based on a grain: software/microsoft/office.sls:

{% set office_version = grains['microsoft:office:version'] %}
office-installer-files:
    {% if 'microsoft.office' in salt['pkg.list_pkgs']() %}
        file.absent:
            - name: c:\salt\var\cache\salt\minion\files\base\win\repo\microsoft\office\{{ office_version }}
    {% else %}
        file.recurse:
            - name: c:\salt\var\cache\salt\minion\files\base\win\repo\microsoft\office\{{ office_version }}
            - source: salt://win/repo/microsoft/office/{{ office_version }}
    {% endif %}

microsoft.office:
    pkg:
        - installed
        - require:
            - file: office-installer-files

eliasp avatar Jan 08 '15 23:01 eliasp