Skip to content

Unable to run "win_servermanager.list_available" on minion. #33058

Closed

Description

@aclemetson

Description of Issue/Question

After upgrading to the Dev branch, I was unable to run "win_servermanager.list_available" on a minion. The functionality was previously available on 2015.8.3

Setup

Master Version: 2016.3.0rc1-1112-gb628b55 (Boron)
Minion Version: v2016.3.0rc2-348-g111e927
The command run: "salt win_servermanager.list_available"
Windows Version: 2008 R2 Enterprise

Steps to Reproduce Issue

The error message in return is:

    The term 'Get-WindowsFeature' is not recognized as the name of a cmdlet, functi
    on, script file, or operable program. Check the spelling of the name, or if a p
    ath was included, verify that the path is correct and try again.
    At line:1 char:19
    + Get-WindowsFeature <<<<  -erroraction silentlycontinue -warningaction silentl
    ycontinue
        + CategoryInfo          : ObjectNotFound: (Get-WindowsFeature:String) [],
       CommandNotFoundException
        + FullyQualifiedErrorId : CommandNotFoundException

Versions Report

salt --versions-report
Salt Version:
           Salt: 2016.3.0rc1-1112-gb628b55

Dependency Versions:
         Jinja2: 2.7.2
       M2Crypto: 0.21.1
           Mako: Not Installed
         PyYAML: 3.11
          PyZMQ: 14.7.0
         Python: 2.7.5 (default, Oct 11 2015, 17:47:16)
           RAET: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.0.5
           cffi: 0.8.6
       cherrypy: Not Installed
       dateutil: 1.5
          gitdb: 0.5.4
      gitpython: 0.3.2 RC1
          ioflo: Not Installed
        libgit2: 0.21.0
        libnacl: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.7
   mysql-python: Not Installed
      pycparser: 2.14
       pycrypto: 2.6.1
         pygit2: 0.21.4
   python-gnupg: Not Installed
          smmap: 0.8.1
        timelib: Not Installed

System Versions:
           dist: redhat 7.2 Maipo
        machine: x86_64
        release: 3.10.0-327.10.1.el7.x86_64
         system: Linux
        version: Red Hat Enterprise Linux Server 7.2 Maipo

Possible Solution

When looking at win_servermanager.py between versions 2015.8.3 and 2016.3.0, we noticed:

2015.8.3:

    return __salt__['cmd.run'](
            'Import-Module ServerManager ; {0}'.format(func),
            shell='powershell',
            python_shell=True)

Notice how the command imports a module.

2016.3.0

    cmd = 'Get-WindowsFeature -erroraction silentlycontinue ' \
          '-warningaction silentlycontinue'
    return __salt__['cmd.shell'](cmd, shell='powershell')

This version does not run a Import-Module cmdlet. Running cmd.shell with the leading Import-Module ServerManager; solves the issue.

Activity

  1. added
    bug
    severity-medium
    Regression
    P3
    Platform
    on May 5, 2016
  2. added this to the Approved milestone on May 5, 2016
  3. jfindlay commented on May 5, 2016

    @jfindlay
    Contributor

    @aclemetson, thanks for reporting. Ping @twangboy.

  4. modified the milestones: B -3, Approved on May 6, 2016
  5. self-assigned this
    on May 6, 2016
  6. added
    severity-critical
    on May 6, 2016
  7. added
    bug
    and removed
    bug
    on May 6, 2016
  8. twangboy commented on May 6, 2016

    @twangboy
    Contributor

    @meggiebot This needs to be merged forward

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Execution-ModuleP3PlatformRegressionWindowsZRELEASED - Boronbugseverity-criticalseverity-medium

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions