Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gid_from_name fails on MacOS with "gid must be an integer". #45142

Closed
dumol opened this issue Dec 22, 2017 · 3 comments
Closed

gid_from_name fails on MacOS with "gid must be an integer". #45142

dumol opened this issue Dec 22, 2017 · 3 comments
Labels
Bug broken, incorrect, or confusing behavior P2 Priority 2 severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around stale
Milestone

Comments

@dumol
Copy link
Contributor

dumol commented Dec 22, 2017

Description of Issue/Question

When trying to create a user through Salt with gid_from_name: True, our MacOS build slaves fail with SaltInvocationError: gid must be an integer.

Setup

Master is Ubuntu 14.04 running latest stable upstream version: 2017.7.2.

Minions are using Homebrew. One has the stable version installed by default, the other has the head version installed with brew install --HEAD saltstack:

bs1f-macos-1012-x64-54:
    2016.11.1
bs1g-macos-1012-x64-55:
    2018.2.0-18-g0f8f507

State to replicate the issue:

dev:
  user.present:
    - gid_from_name: True

Steps to Reproduce Issue

When applying above state, following errors are returned on MacOS build slaves:

bs1f-macos-1012-x64-54:
----------
          ID: dev
    Function: user.present
      Result: False
     Comment: An exception occurred in this state: Traceback (most recent call last):
                File "/usr/local/Cellar/saltstack/2016.11.1/libexec/lib/python2.7/site-packages/salt/state.py", line 1744, in call
                  **cdata['kwargs'])
                File "/usr/local/Cellar/saltstack/2016.11.1/libexec/lib/python2.7/site-packages/salt/loader.py", line 1702, in wrapper
                  return f(*args, **kwargs)
                File "/usr/local/Cellar/saltstack/2016.11.1/libexec/lib/python2.7/site-packages/salt/states/user.py", line 549, in present
                  __salt__['user.ch{0}'.format(key)](name, val)
                File "/usr/local/Cellar/saltstack/2016.11.1/libexec/lib/python2.7/site-packages/salt/modules/mac_user.py", line 223, in chgid
                  raise SaltInvocationError('gid must be an integer')
              SaltInvocationError: gid must be an integer
     Started: 20:51:07.732041
    Duration: 3431.995 ms
     Changes:

Summary for bs1f-macos-1012-x64-54
------------
Succeeded: 0
Failed:    1
------------
Total states run:     1
Total run time:   3.432 s
bs1g-macos-1012-x64-55:
----------
          ID: dev
    Function: user.present
      Result: False
     Comment: An exception occurred in this state: Traceback (most recent call last):
                File "/usr/local/Cellar/saltstack/HEAD-0f8f507/libexec/lib/python2.7/site-packages/salt/state.py", line 1934, in call
                  **cdata['kwargs'])
                File "/usr/local/Cellar/saltstack/HEAD-0f8f507/libexec/lib/python2.7/site-packages/salt/loader.py", line 1799, in wrapper
                  return f(*args, **kwargs)
                File "/usr/local/Cellar/saltstack/HEAD-0f8f507/libexec/lib/python2.7/site-packages/salt/states/user.py", line 566, in present
                  __salt__['user.ch{0}'.format(key)](name, val)
                File "/usr/local/Cellar/saltstack/HEAD-0f8f507/libexec/lib/python2.7/site-packages/salt/modules/mac_user.py", line 226, in chgid
                  raise SaltInvocationError('gid must be an integer')
              SaltInvocationError: gid must be an integer
     Started: 20:51:08.615991
    Duration: 6725.256 ms
     Changes:

Summary for bs1g-macos-1012-x64-55
------------
Succeeded: 0
Failed:    1
------------
Total states run:     1
Total run time:   6.725 s

Debug logs on the minions show the same error.

Versions Report

Master:

# salt --versions-report
Salt Version:
           Salt: 2017.7.2

Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 1.5
      docker-py: Not Installed
          gitdb: 0.5.4
      gitpython: 0.3.2 RC1
          ioflo: Not Installed
         Jinja2: 2.7.2
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.6
   mysql-python: 1.2.3
      pycparser: Not Installed
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 2.7.6 (default, Nov 23 2017, 15:49:48)
   python-gnupg: Not Installed
         PyYAML: 3.10
          PyZMQ: 14.0.1
           RAET: Not Installed
          smmap: 0.8.2
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.0.5

System Versions:
           dist: Ubuntu 14.04 trusty
         locale: UTF-8
        machine: x86_64
        release: 3.13.0-137-generic
         system: Linux
        version: Ubuntu 14.04 trusty

MacOS minion with stable Homebrew version:

$ salt --versions-report
Salt Version:
           Salt: 2016.11.1

Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.8
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.8
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
         pygit2: Not Installed
         Python: 2.7.10 (default, Jul 30 2016, 19:40:32)
   python-gnupg: Not Installed
         PyYAML: 3.12
          PyZMQ: 16.0.2
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.4.2
            ZMQ: 4.2.1

System Versions:
           dist:
        machine: x86_64
        release: 16.3.0
         system: Darwin
        version: 10.12.2 x86_64

MacOS minion with head Homebrew version:

$ salt --versions-report
Salt Version:
           Salt: 2018.2.0-18-g0f8f507

Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: Not Installed
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.9.6
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.8
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 2.7.10 (default, Jul 30 2016, 18:31:42)
   python-gnupg: Not Installed
         PyYAML: 3.12
          PyZMQ: 16.0.2
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.5.2
            ZMQ: 4.2.3

System Versions:
           dist:
         locale: US-ASCII
        machine: x86_64
        release: 16.1.0
         system: Darwin
        version: 10.12.1 x86_64
@garethgreenaway garethgreenaway added this to the Approved milestone Dec 24, 2017
@garethgreenaway garethgreenaway added Bug broken, incorrect, or confusing behavior severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around P2 Priority 2 labels Dec 24, 2017
@garethgreenaway
Copy link
Contributor

@dumol Thanks for the report. Seems like the code that is returning the GID might be returning it as a string.

@dumol dumol changed the title gid_from_name fails on MacOS with "git must be an integer". gid_from_name fails on MacOS with "gid must be an integer". Dec 25, 2017
@dumol
Copy link
Contributor Author

dumol commented Feb 7, 2018

As discussed in #45345, the above construct is not actually supported, but here's another one that generates the same error on MacOS (but works fine on a plethora of Linux distros, FreeBSD and OpenBSD with the appropriate group name) :

dev:
  user.present:
    - gid: admin

As far as I can tell from the official documentation, gid, the default group id should also accept a group name, according to https://docs.saltstack.com/en/latest/ref/states/all/salt.states.user.html#salt.states.user.present.

@stale
Copy link

stale bot commented May 23, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.

@stale stale bot added the stale label May 23, 2019
@stale stale bot closed this as completed May 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior P2 Priority 2 severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around stale
Projects
None yet
Development

No branches or pull requests

2 participants