saltstack / salt

Software to automate the management and configuration of any infrastructure or application at scale. Get access to the Salt software package repository here:
https://repo.saltproject.io/
Apache License 2.0
14.15k stars 5.48k forks source link

Salt + chocolatey + java upgrade problem #24452

Closed mvivaldi closed 9 years ago

mvivaldi commented 9 years ago

Chocolatey does not upgrade the package jre8 if you run it with salt:

# salt SEGRETERIA2014 pkg.list_pkgs

SEGRETERIA2014:
    ----------
    Java 8 Update 31 (64-bit):
        8.0.310

# salt SEGRETERIA2014 chocolatey.install jre8 force=true

SEGRETERIA2014:
    Chocolatey v0.9.9.6
    Installing the following packages:
    jre8
    By installing you accept licenses for the packages.

    jre8 v8.0.45 (forced)
     Downloading jre8 32 bit
       from 'http://javadl.sun.com/webapps/download/AutoDL?BundleId=106246'
     Installing jre8...
     jre8 has been installed.
     Downloading jre8 64 bit
       from 'http://javadl.sun.com/webapps/download/AutoDL?BundleId=106248'
     Installing jre8...
     jre8 has been installed.
     The install of jre8 was successful.

    Chocolatey installed 1/1 package(s). 0 package(s) failed.
     See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

(I cut some text from the first command)

after this if I run again:

# salt SEGRETERIA2014 pkg.list_pkgs

SEGRETERIA2014:
    ----------
    Java 8 Update 31 (64-bit):
        8.0.310

on the pc:

C:\Users\administrator>java -version
java version "1.8.0_31"
Java(TM) SE Runtime Environment (build 1.8.0_31-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode)

I have the same problem if I run chocolatey with salt and powershell:

# salt SEGRETERIA2014 cmd.run 'choco install -y --force jre8  ' shell=powershell

SEGRETERIA2014:
    Chocolatey v0.9.9.6
    Installing the following packages:
    jre8
    By installing you accept licenses for the packages.

    jre8 v8.0.45 (forced)
     Downloading jre8 32 bit
       from 'http://javadl.sun.com/webapps/download/AutoDL?BundleId=106246'
     Installing jre8...
     jre8 has been installed.
     Downloading jre8 64 bit
       from 'http://javadl.sun.com/webapps/download/AutoDL?BundleId=106248'
     Installing jre8...
     jre8 has been installed.
     The install of jre8 was successful.

    Chocolatey installed 1/1 package(s). 0 package(s) failed.
     See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

on the pc:

C:\Users\administrator>java -version
java version "1.8.0_31"
Java(TM) SE Runtime Environment (build 1.8.0_31-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode)

by the way chocolatey think to have java the lastest java version installed (I used the --force switch because of this):

# salt SEGRETERIA2014 cmd.run 'choco upgrade -y jre8  ' shell=powershell
SEGRETERIA2014:
    Chocolatey v0.9.9.6
    Upgrading the following packages:
    jre8
    By upgrading you accept licenses for the packages.
    jre8 v8.0.45 is the latest version available based on your source(s).

    Chocolatey upgraded 0/1 package(s). 0 package(s) failed.
     See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

but if I run on the windows machine:

Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. Tutti i diritti riservati.

PS C:\Users\administrator> java -version
java version "1.8.0_31"
Java(TM) SE Runtime Environment (build 1.8.0_31-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode)
PS C:\Users\administrator> choco install -y --force jre8
Chocolatey v0.9.9.6
Installing the following packages:
jre8
By installing you accept licenses for the packages.

jre8 v8.0.45 (forced)
 Downloading jre8 32 bit
   from 'http://javadl.sun.com/webapps/download/AutoDL?BundleId=106246'
 Installing jre8...
 jre8 has been installed.
 Downloading jre8 64 bit
   from 'http://javadl.sun.com/webapps/download/AutoDL?BundleId=106248'
 Installing jre8...
 jre8 has been installed.
 The install of jre8 was successful.

Chocolatey installed 1/1 package(s). 0 package(s) failed.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
PS C:\Users\administrator> java -version
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
PS C:\Users\administrator>

The same problem occour with the last 2 versions of salt (2015.5.0 and 2014.7.5... I didn't try with earlier version) on windows 7/8/8.1 (I have abount 100 windows pc with salt+chocolatey), I don't know if it is a problem of salt (some kind of permission? but other packages like vlc upgrade without problem) or of chocolatey (but if I run the command on the pc it work!).

jfindlay commented 9 years ago

@mvivaldi, thanks for the report.

twangboy commented 9 years ago

@mvivaldi I've tried replicating this issue unsuccessfully. Could you answer a few questions? How did you install chocolatey? What user is the salt-minion service running under? What version of windows? Could you send the versions report for the system you were testing on? salt '*' test.version_report

I was running Win2008r2 64bit. Here's my versions report:

               Salt: 2014.7.6-55-ga18dada
             Python: 2.7.8 (default, Jun 30 2014, 16:08:48) [MSC v.1500 64 bit (AMD64)]
             Jinja2: 2.7.3
           M2Crypto: 0.21.1
     msgpack-python: 0.4.6
       msgpack-pure: Not Installed
           pycrypto: 2.6.1
            libnacl: Not Installed
             PyYAML: 3.11
              ioflo: Not Installed
              PyZMQ: 14.6.0
               RAET: Not Installed
                ZMQ: 4.0.5
               Mako: Not Installed

I installed chocolatey using salt '*' chocolatey.bootstrap. I installed jre8.0.31 manually. I followed your instructions to reproduce the error and they all worked on my test box.

mvivaldi commented 9 years ago

Sorry, I am out of office for the next 2 weeks...

for what I remember:

I'll answer more precisely when I'll be back at my office

Thank you

mvivaldi commented 9 years ago

more info:

# salt chambery  test.versions_report
chambery:
               Salt: 2015.5.0
             Python: 2.7.8 (default, Jun 30 2014, 16:08:48) [MSC v.1500 64 bit (AMD64)]
             Jinja2: 2.7.3
           M2Crypto: 0.21.1
     msgpack-python: 0.4.5
       msgpack-pure: Not Installed
           pycrypto: 2.6
            libnacl: Not Installed
             PyYAML: 3.11
              ioflo: Not Installed
              PyZMQ: 14.6.0
               RAET: Not Installed
                ZMQ: 4.0.5
               Mako: Not Installed

I use salt to upgrade the salt minion on a windows machine:

salt chambery cmd.run '\\fileserver\software\Salt-Minion-2015.5.0-2-AMD64-Setup.exe /S /master=salt /minion-name=%COMPUTERNAME%' shell=powershell

salt is running with the username: NT AUTHORITY\SYSTEM

grains.items:


# salt chambery grains.items
chambery:
    ----------
    SSDs:
    biosversion:
        Default System BIOS
    cpu_model:
        Intel64 Family 6 Model 30 Stepping 5, GenuineIntel
    cpuarch:
        AMD64
    domain:
        pc.itc.it
    fqdn:
        chambery.pc.itc.it
    fqdn_ip4:
        - 192.168.126.14
    fqdn_ip6:
        - fe80::b075:925d:32a5:b2e9%3
    gpus:
    host:
        chambery
    hwaddr_interfaces:
        ----------
        Intel(R) 82577LM Gigabit Network Connection:
            5C:26:0A:08:37:1D
    id: 
        chambery.pc.itc.it
    ip4_interfaces:
        ----------
        Intel(R) 82577LM Gigabit Network Connection:
            - 192.168.126.14
    ip6_interfaces:
        ----------
        Intel(R) 82577LM Gigabit Network Connection:
            - fe80::b075:925d:32a5:b2e9
    ip_interfaces:
        ----------
        Intel(R) 82577LM Gigabit Network Connection:
            - 192.168.126.14
            - fe80::b075:925d:32a5:b2e9
    ipv4:
        - 192.168.126.14
    ipv6:
        - fe80::b075:925d:32a5:b2e9
    kernel:
        Windows
    kernelrelease:
        6.3.9600
    locale_info:
        ----------
        defaultencoding:
            cp1252
        defaultlanguage:
            it_IT
        detectedencoding:
            cp850
    localhost:
        chambery
    manufacturer:
        Dell Inc.
    master:
        salt
    mem_total:
        4096
    motherboard:
        ----------
        productname:
            0N5KHN
        serialnumber:
            /71ZQWN1/CN129610B70241/
    nodename:
        chambery
    num_cpus:
        8
    num_gpus:
        0
    os: 
        Windows
    os_family:
        Windows
    osfullname:
        Microsoft Windows 8.1 Enterprise
    osmanufacturer:
        Microsoft Corporation
    osrelease:
        8
    osversion:
        6.3.9600
    path:
        C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\ProgramData\chocolatey\bin;C:\Program Files\Java\jre1.8.0_45\bin;C:\Program Files (x86)\Skype\Phone\;
    productname:
        Latitude E6510
    ps: 
        tasklist.exe
    pythonexecutable:
        c:\salt\bin\python.exe
    pythonpath:
        - c:\salt\bin\Scripts
        - c:\salt\bin\lib\site-packages\m2crypto-0.21.1-py2.7-win-amd64.egg
        - c:\salt\bin\lib\site-packages\pycrypto-2.6-py2.7-win-amd64.egg
        - c:\salt\bin\lib\site-packages\pywin32-219-py2.7-win-amd64.egg
        - c:\salt\bin\python27.zip
        - c:\salt\bin\DLLs
        - c:\salt\bin\lib
        - c:\salt\bin\lib\plat-win
        - c:\salt\bin\lib\lib-tk
        - c:\salt\bin
        - c:\salt\bin\lib\site-packages
    pythonversion:
        - 2
        - 7
        - 8
        - final
        - 0
    saltpath:
        c:\salt\bin\lib\site-packages\salt
    saltversion:
        2015.5.0
    saltversioninfo:
        - 2015
        - 5
        - 0
        - 0
    serialnumber:
        71ZQWN1
    server_id:
        1180742311
    shell:
        /bin/sh
    timezone:
        (UTC+1.00) Amsterdam, Berlino, Berna, Roma, Stoccolma, Vienna
    windowsdomain:
        pc.itc.it
    zmqversion:
        4.0.5

on the salt master i run:

[root@saltstack scripts]# salt chambery pkg.list_pkgs | grep -i java
[root@saltstack scripts]# salt chambery cmd.run 'choco uninstall -y jre8' shell=powershell
chambery:
    Chocolatey v0.9.9.8
    Uninstalling the following packages:
    jre8

    jre8 v8.0.45
     L'operazione specificata è valida solo per i prodotti correntemente installati.

     L'operazione specificata è valida solo per i prodotti correntemente installati.

     AVVISO: Javaruntime may require a reboot to complete the uninstallation.
     Skipping auto uninstaller - AutoUninstaller feature is not enabled.
     jre8 has been successfully uninstalled.

    Chocolatey uninstalled 1/1 packages. 0 packages failed.
     See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
[root@saltstack scripts]# salt chambery cmd.run 'choco install -y jre8' shell=powershell
chambery:
    Chocolatey v0.9.9.8
    Installing the following packages:
    jre8
    By installing you accept licenses for the packages.

    jre8 v8.0.45
     Downloading jre8 32 bit
       from 'http://javadl.sun.com/webapps/download/AutoDL?BundleId=106246'
     Installing jre8...
     jre8 has been installed.
     Downloading jre8 64 bit
       from 'http://javadl.sun.com/webapps/download/AutoDL?BundleId=106248'
     Installing jre8...
     jre8 has been installed.
     The install of jre8 was successful.

    Chocolatey installed 1/1 package(s). 0 package(s) failed.
     See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
[root@saltstack scripts]# salt chambery pkg.list_pkgs | grep -i java
[root@saltstack scripts]# 

after this I can't find any trace of java on chambery...

if you need more tests, or anything else, let me know.

Thank you

twangboy commented 9 years ago

@mvivaldi Could this have something to do with the locale/language of windows? What language of Windows are you running? What are the locale settings? Is it all set up Italian?

mvivaldi commented 9 years ago

I tried with an English (US) pc with the same result, I'll try with some other pc...

mvivaldi commented 9 years ago

some other info... if I run:

salt PELTOPEKKA cmd.run 'c:\programdata\chocolatey\choco install -y jre8 -version 8.0.40' shell=powershell

in this case it works: on the pc i found java 8.0.40

and if I try to upgrade:

salt PELTOPEKKA cmd.run 'c:\programdata\chocolatey\choco upgrade all -y' shell=powershell

it uninstall the 8.0.40 version, but it's unable to install the new version (chocolatey think to have it installed)...

mvivaldi commented 9 years ago

Some other info... I think the problem is more on chocolatey than on salt: if I run (from an administrator account):

c:\PSTools>psexec -s  \\lorentz c:\programdata\chocolatey\choco.exe install jre8 -y --force

PsExec v2.11 - Execute processes remotely
Copyright (C) 2001-2014 Mark Russinovich
Sysinternals - www.sysinternals.com

Chocolatey v0.9.9.8
Installing the following packages:
jre8
By installing you accept licenses for the packages.

jre8 v8.0.45 (forced)
 Downloading jre8 32 bit
   from 'http://javadl.sun.com/webapps/download/AutoDL?BundleId=106246'
 Installing jre8...
 jre8 has been installed.
 Downloading jre8 64 bit
   from 'http://javadl.sun.com/webapps/download/AutoDL?BundleId=106248'
 Installing jre8...
 jre8 has been installed.
 The install of jre8 was successful.

Chocolatey installed 1/1 package(s). 0 package(s) failed.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
c:\programdata\chocolatey\choco.exe exited on lorentz with error code 0.

psexec is a tool to launch powershell command in a remote computer, the -s switch launch the command with the SYSTEM account (the same of the salt-minion service)

After this I cannot find java 8.0.45 on the pc.... but if I run:

c:\PSTools>psexec  \\lorentz c:\programdata\chocolatey\choco.exe install jre8 -y --force

PsExec v2.11 - Execute processes remotely
Copyright (C) 2001-2014 Mark Russinovich
Sysinternals - www.sysinternals.com

Chocolatey v0.9.9.8
Installing the following packages:
jre8
By installing you accept licenses for the packages.

jre8 v8.0.45 (forced)
 Downloading jre8 32 bit
   from 'http://javadl.sun.com/webapps/download/AutoDL?BundleId=106246'
 Installing jre8...
 jre8 has been installed.
 Downloading jre8 64 bit
   from 'http://javadl.sun.com/webapps/download/AutoDL?BundleId=106248'
 Installing jre8...
 jre8 has been installed.
 The install of jre8 was successful.

Chocolatey installed 1/1 package(s). 0 package(s) failed.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
c:\programdata\chocolatey\choco.exe exited on lorentz with error code 0.

java is updated to 8.0.45

I'm opening a ticket on the chocolatey tracker

Thank you