Salt: git.latest is failing in FreeBSD + Python 2.7.14

Created on 11 Oct 2017  路  14Comments  路  Source: saltstack/salt

git.latest is failing in FreeBSD + Python 2.7.14

Setup

I have the following SLS:

deploy-metadata:
  git.latest:
    - name: {{ pillar['git_app_metadata'] }}
    - rev: master
    - branch: master
    - target: /var/zxid/cot
    - user: git
    - force_checkout: True
    - force_fetch: True
    - force_reset: True

Which produces the following error:

I, [2017-10-11T13:55:33.706582 #66706]  INFO -- appserver-freebsd-103: [INFO    ] Running state [/var/zxid/cot] at time 09:55:38.135284
I, [2017-10-11T13:55:33.706855 #66706]  INFO -- appserver-freebsd-103: [INFO    ] Executing state file.directory for /var/zxid/cot
I, [2017-10-11T13:55:33.707582 #66706]  INFO -- appserver-freebsd-103: [INFO    ] {'/var/zxid/cot': 'New Dir'}
I, [2017-10-11T13:55:33.707704 #66706]  INFO -- appserver-freebsd-103: [INFO    ] Completed state [/var/zxid/cot] at time 09:55:38.136856 duration_in_ms=1.572
I, [2017-10-11T13:55:33.711863 #66706]  INFO -- appserver-freebsd-103: [INFO    ] Running state [[email protected]:sysadmins/app-metadata.git] at time 09:55:38.140844
I, [2017-10-11T13:55:33.712048 #66706]  INFO -- appserver-freebsd-103: [INFO    ] Executing state git.latest for [email protected]:sysadmins/app-metadata.git
I, [2017-10-11T13:55:33.712374 #66706]  INFO -- appserver-freebsd-103: [INFO    ] Checking remote revision for [email protected]:sysadmins/app-metadata.git
I, [2017-10-11T13:55:33.713108 #66706]  INFO -- appserver-freebsd-103: [INFO    ] Executing command ['git', 'ls-remote', '[email protected]:sysadmins/app-metadata.git'] as user 'git' in directory '/home/git'
I, [2017-10-11T13:55:34.541713 #66706]  INFO -- appserver-freebsd-103: [INFO    ] Executing command ['git', 'rev-parse', '--show-toplevel'] as user 'git' in directory '/var/zxid/cot'
I, [2017-10-11T13:55:34.761200 #66706]  INFO -- appserver-freebsd-103: [ERROR   ] Command '['git', 'rev-parse', '--show-toplevel']' failed with return code: 128
I, [2017-10-11T13:55:34.761408 #66706]  INFO -- appserver-freebsd-103: [ERROR   ] stderr: fatal: Not a git repository (or any of the parent directories): .git
I, [2017-10-11T13:55:34.761642 #66706]  INFO -- appserver-freebsd-103: [ERROR   ] retcode: 128
I, [2017-10-11T13:55:34.761869 #66706]  INFO -- appserver-freebsd-103: [INFO    ] Executing command ['git', 'clone', '--', '[email protected]:sysadmins/app-metadata.git', '/var/zxid/cot'] as user 'git' in directory '/tmp'
I, [2017-10-11T13:55:35.912095 #66706]  INFO -- appserver-freebsd-103: [INFO    ] Executing command ['git', 'for-each-ref', '--format', '%(refname:short)', 'refs/heads/'] as user 'git' in directory '/var/zxid/cot'
I, [2017-10-11T13:55:36.130826 #66706]  INFO -- appserver-freebsd-103: [INFO    ] Checking local revision for /var/zxid/cot
I, [2017-10-11T13:55:36.131040 #66706]  INFO -- appserver-freebsd-103: [INFO    ] Executing command ['git', 'rev-parse', 'HEAD'] as user 'git' in directory '/var/zxid/cot'
I, [2017-10-11T13:55:36.356320 #66706]  INFO -- appserver-freebsd-103: [ERROR   ] Unexpected exception in git.latest state
I, [2017-10-11T13:55:36.356387 #66706]  INFO -- appserver-freebsd-103: Traceback (most recent call last):
I, [2017-10-11T13:55:36.356409 #66706]  INFO -- appserver-freebsd-103:   File "/usr/local/lib/python2.7/site-packages/salt/states/git.py", line 1738, in latest
I, [2017-10-11T13:55:36.356429 #66706]  INFO -- appserver-freebsd-103:     _get_local_rev_and_branch(target, user, password)
I, [2017-10-11T13:55:36.356446 #66706]  INFO -- appserver-freebsd-103:   File "/usr/local/lib/python2.7/site-packages/salt/states/git.py", line 118, in _get_local_rev_and_branch
I, [2017-10-11T13:55:36.356464 #66706]  INFO -- appserver-freebsd-103:     ignore_retcode=True)
I, [2017-10-11T13:55:36.356481 #66706]  INFO -- appserver-freebsd-103:   File "/usr/local/lib/python2.7/site-packages/salt/modules/git.py", line 3702, in revision
I, [2017-10-11T13:55:36.356498 #66706]  INFO -- appserver-freebsd-103:     ignore_retcode=ignore_retcode)['stdout']
I, [2017-10-11T13:55:36.356514 #66706]  INFO -- appserver-freebsd-103:   File "/usr/local/lib/python2.7/site-packages/salt/modules/git.py", line 286, in _git_run
I, [2017-10-11T13:55:36.356529 #66706]  INFO -- appserver-freebsd-103:     **kwargs)
I, [2017-10-11T13:55:36.356546 #66706]  INFO -- appserver-freebsd-103:   File "/usr/local/lib/python2.7/site-packages/salt/modules/cmdmod.py", line 1662, in run_all
I, [2017-10-11T13:55:36.356561 #66706]  INFO -- appserver-freebsd-103:     **kwargs)
I, [2017-10-11T13:55:36.356578 #66706]  INFO -- appserver-freebsd-103:   File "/usr/local/lib/python2.7/site-packages/salt/modules/cmdmod.py", line 527, in _run
I, [2017-10-11T13:55:36.356594 #66706]  INFO -- appserver-freebsd-103:     proc = salt.utils.timed_subprocess.TimedProc(cmd, **kwargs)
I, [2017-10-11T13:55:36.356610 #66706]  INFO -- appserver-freebsd-103:   File "/usr/local/lib/python2.7/site-packages/salt/utils/timed_subprocess.py", line 42, in __init__
I, [2017-10-11T13:55:36.356626 #66706]  INFO -- appserver-freebsd-103:     self.process = subprocess.Popen(args, **kwargs)
I, [2017-10-11T13:55:36.356643 #66706]  INFO -- appserver-freebsd-103:   File "/usr/local/lib/python2.7/subprocess.py", line 390, in __init__
I, [2017-10-11T13:55:36.356659 #66706]  INFO -- appserver-freebsd-103:     errread, errwrite)
I, [2017-10-11T13:55:36.356674 #66706]  INFO -- appserver-freebsd-103:   File "/usr/local/lib/python2.7/subprocess.py", line 1025, in _execute_child
I, [2017-10-11T13:55:36.356690 #66706]  INFO -- appserver-freebsd-103:     raise child_exception
I, [2017-10-11T13:55:36.356706 #66706]  INFO -- appserver-freebsd-103: ValueError: illegal environment variable name
I, [2017-10-11T13:55:36.357037 #66706]  INFO -- appserver-freebsd-103: [ERROR   ] {'new': '[email protected]:sysadmins/app-metadata.git => /var/zxid/cot'}
I, [2017-10-11T13:55:36.357147 #66706]  INFO -- appserver-freebsd-103: [INFO    ] Completed state [[email protected]:sysadmins/app-metadata.git] at time 09:55:40.784028 duration_in_ms=2643.183

Steps to Reproduce Issue

This started to happen with Python upgrade to 2.7.14 (Works ok in 2.7.13). According to [Python 2.7.14 changelog] there are some changes in subprocess module and environments.

Versions Report

We are running 2016.11.6.

ZD cannot-reproduce

Most helpful comment

For the record if any FreeBSD+SaltStack user needs to solve this a workaround we had to do on official FreeBSD AMI is this:

export FREEBSD_VERSION=`/bin/freebsd-version | /usr/bin/cut -f1-2 -d'-'`
export COMPONENT_URL="http://ftp.freebsd.org/pub/FreeBSD/releases/`uname -m`/$FREEBSD_VERSION"
su -m root -c 'cd / && fetch -o - $COMPONENT_URL/games.txz | tar -tzf - | xargs rm'

Thanks!

All 14 comments

ZD-1861

@amontalban I haven't been able to reproduce this one. Is there something unusual that is being set in the git users environment?

Hi @garethgreenaway, let me see if I can send you a reproduce environment. (For the ticket record we have same issue in 2016.11.8). Thanks!

HI @garethgreenaway

I work together with Andres. I spend a few hours trying to get where is the issue without luck, but there are a few things I want to share>

  • Looks like this issue is random, what I mean is that is not always the same git command that fails and also sometimes that state complete without issues.
  • To me, env variables are always the same, even when state complete just fine.
  • We thbi that the issue could be some kind related to AWS FreeBSD AMI, because we cannot reproduce the same issue using vagrant.

An example with a few debug lines

("['git', 'rev-parse', 'f47f7785425107069792c2d43619d64fe52f42ba^{commit}']", '/var/zxid/cot', 'git', 'None', '{}')
('RUN ALL: ', "['git', 'rev-parse', 'f47f7785425107069792c2d43619d64fe52f42ba^{commit}']")
[INFO    ] Executing command ['git', 'rev-parse', 'f47f7785425107069792c2d43619d64fe52f42ba^{commit}'] as user 'git' in directory '/var/zxid/cot'
('XXXXXXXXXXXXXXXXXXXXX Var: ', 'GROUP', 'Value: ', 'wheel')
('XXXXXXXXXXXXXXXXXXXXX Var: ', 'REMOTEHOST', 'Value: ', 'XXX.XXX.XXX.XXX')
('XXXXXXXXXXXXXXXXXXXXX Var: ', 'HOSTTYPE', 'Value: ', 'FreeBSD')
('XXXXXXXXXXXXXXXXXXXXX Var: ', 'LOGNAME', 'Value: ', 'root')
('XXXXXXXXXXXXXXXXXXXXX Var: ', 'USER', 'Value: ', 'root')
('XXXXXXXXXXXXXXXXXXXXX Var: ', 'HOME', 'Value: ', '/root')
('XXXXXXXXXXXXXXXXXXXXX Var: ', 'PATH', 'Value: ', '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin')
('XXXXXXXXXXXXXXXXXXXXX Var: ', 'TERM', 'Value: ', 'xterm-256color')
('XXXXXXXXXXXXXXXXXXXXX Var: ', 'SHELL', 'Value: ', '/bin/csh')
('XXXXXXXXXXXXXXXXXXXXX Var: ', 'SHLVL', 'Value: ', '2')
('XXXXXXXXXXXXXXXXXXXXX Var: ', 'BLOCKSIZE', 'Value: ', 'K')
('XXXXXXXXXXXXXXXXXXXXX Var: ', 'EDITOR', 'Value: ', 'vi')
('XXXXXXXXXXXXXXXXXXXXX Var: ', 'OSTYPE', 'Value: ', 'FreeBSD')
('XXXXXXXXXXXXXXXXXXXXX Var: ', 'SUDO_USER', 'Value: ', 'root')
('XXXXXXXXXXXXXXXXXXXXX Var: ', 'USERNAME', 'Value: ', 'root')
('XXXXXXXXXXXXXXXXXXXXX Var: ', 'VENDOR', 'Value: ', 'amd')
('XXXXXXXXXXXXXXXXXXXXX Var: ', 'SUDO_UID', 'Value: ', '0')
('XXXXXXXXXXXXXXXXXXXXX Var: ', 'HOST', 'Value: ', 'ip-10-0-1-60')
('XXXXXXXXXXXXXXXXXXXXX Var: ', '_', 'Value: ', '/usr/local/bin/sudo')
('XXXXXXXXXXXXXXXXXXXXX Var: ', 'SUDO_COMMAND', 'Value: ', '/usr/local/bin/salt-call --config-dir=/tmp/kitchen/srv/salt --local state.apply metadata saltenv=appserver --log-level=debug --log-file=/tmp/highstate.log --retcode-passthrough')
('XXXXXXXXXXXXXXXXXXXXX Var: ', 'SUDO_GID', 'Value: ', '0')
('XXXXXXXXXXXXXXXXXXXXX Var: ', 'PWD', 'Value: ', '/root')
('XXXXXXXXXXXXXXXXXXXXX Var: ', 'MAIL', 'Value: ', '/var/mail/root')
('XXXXXXXXXXXXXXXXXXXXX Var: ', 'MACHTYPE', 'Value: ', 'x86_64')
('XXXXXXXXXXXXXXXXXXXXX Var: ', 'PAGER', 'Value: ', 'more')
[ERROR   ] Unexpected exception in git.latest state
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/salt/states/git.py", line 947, in latest
    ignore_retcode=True)
  File "/usr/local/lib/python2.7/site-packages/salt/modules/git.py", line 3675, in rev_parse
    ignore_retcode=ignore_retcode)['stdout']
  File "/usr/local/lib/python2.7/site-packages/salt/modules/git.py", line 309, in _git_run
    **kwargs)
  File "/usr/local/lib/python2.7/site-packages/salt/modules/cmdmod.py", line 1678, in run_all
    **kwargs)
  File "/usr/local/lib/python2.7/site-packages/salt/modules/cmdmod.py", line 527, in _run
    proc = salt.utils.timed_subprocess.TimedProc(cmd, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/salt/utils/timed_subprocess.py", line 42, in __init__
    self.process = subprocess.Popen(args, **kwargs)
  File "/usr/local/lib/python2.7/subprocess.py", line 390, in __init__
    errread, errwrite)
  File "/usr/local/lib/python2.7/subprocess.py", line 1027, in _execute_child
    raise child_exception
ValueError: illegal environment variable name
[ERROR   ] illegal environment variable name

Hi @garethgreenaway,

As @abednarik mentioned this is something we have in with FreeBSD official AWS AMI, the steps to reproduce are the following:

  • Create an AWS instance with AMI ami-2d6d6347.
  • Configure the following user-data:
#!/bin/sh
sysrc firstboot_freebsd_update_enable="YES"
sysrc firstboot_pkgs_enable="YES"
sysrc firstboot_pkgs_list="sudo bash git rsync curl ca_root_nss jq python py27-pip"

Then SSH to server, sudo to root (su -m) and execute the following commands:

fetch -o bootstrap-salt.sh https://bootstrap.saltstack.com
sh bootstrap-salt.sh -X git v2016.11.6
git clone https://github.com/amontalban/issue44048.git /usr/local/etc/salt/states
salt-call --local -l all state.apply git

This will install Python 2.7.14 and it fails (It might fail on second or third attempt).


Using the same AMI but with the following user-data it works just fine all the time:

#!/bin/sh
env PAGER=cat
export PAGER=cat
ASSUME_ALWAYS_YES=YES
export ASSUME_ALWAYS_YES
env ASSUME_ALWAYS_YES=YES
sysrc firstboot_freebsd_update_enable="YES"
sysrc firstboot_pkgs_enable="YES"
sysrc firstboot_pkgs_list="sudo bash git rsync curl ca_root_nss jq"
pkg bootstrap -f
fetch http://pkg.freebsd.org/FreeBSD:10:amd64/release_4/All/python27-2.7.13_7.txz
pkg install -y python27-2.7.13_7.txz && rm -f python27-2.7.13_7.txz
pkg lock python27 && pkg install -y python py27-pip

Then SSH to server, sudo to root (su -m) and execute the following commands:

fetch -o bootstrap-salt.sh https://bootstrap.saltstack.com
sh bootstrap-salt.sh -X git v2016.11.6
git clone https://github.com/amontalban/issue44048.git /usr/local/etc/salt/states
salt-call --local -l all state.apply git

If you don't have an account in AWS to test this please send me your public key and I will give you the IPs of instances we have for this issue.

Thanks!

@garethgreenaway

Did you try with Python 2.7? I see a change related to this https://github.com/python/cpython/commit/787826c9316b03ac8a197078ec1cdf98fa840c5c#diff-a6f29e907cbb5fffd44d453bcd7b77d5R3562

@garethgreenaway here is the IPs for this bug:

issue44048 - 2.7.13 = 52.90.2.90
issue44048 - 2.7.14 = 34.227.86.160

@garethgreenaway we have found the root cause and it's not related to SaltStack, you can close this ticket. @abednarik is going to update us with the findings for posterity (But it boils down to fortune command in FreeBSD which is part of games package in default installation).

@amontalban Thanks for the update! I'm really curious to hear how fortune was the root cause.

Hi @garethgreenaway

We finally found the issue.

In Python 2.7.14 was introduced this change https://github.com/python/cpython/commit/9dda2caca8edc7ff1285f6b0d1c5279b51854b7d which disallow using = in environment variables names. For some reason, when parsing env variables, we end up having a env variable name like this Handy bash(1) prompt: PS1="\\u@\\h \\w \\!$ "\n\t\t-- David Scheidt <[email protected]>\nGROUP. As you can see before GROUP, there is a message generated by fortune binary, that for some reason is taken as a env variable. I think is probably a Python bug.

Here 2 examples

'DEBUG || cmd: ', ['git', '--version']) DEBUG || timeout = None DEBUG || with_communicate = True DEBUG || shell = False DEBUG || bg = False DEBUG || stderr = -1 DEBUG || env = {'LC_NUMERIC': 'C', 'GROUP': 'wheel', 'REMOTEHOST': '181.44.153.41', 'LC_MEASUREMENT': 'C', 'LC_CTYPE': 'C', 'HOSTTYPE': 'FreeBSD', 'LOGNAME': 'root', 'USER': 'root', 'HOME': '/root', 'LC_PAPER': 'C', 'PATH': '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', 'TERM': 'xterm-256color', 'SHELL': '/bin/csh', 'SHLVL': '2', 'BLOCKSIZE': 'K', 'EDITOR': 'vi', 'OSTYPE': 'FreeBSD', 'SUDO_USER': 'root', 'USERNAME': 'root', 'VENDOR': 'amd', 'LC_IDENTIFICATION': 'C', 'LC_ADDRESS': 'C', 'SUDO_UID': '0', 'HOST': 'ip-10-0-1-183', '_': '/usr/local/bin/sudo', 'SUDO_COMMAND': '/usr/local/bin/salt-call --config-dir=/tmp/kitchen/srv/salt --local state.apply metadata saltenv=appserver --log-level=all --log-file=/tmp/highstate.log --retcode-passthrough', 'SUDO_GID': '0', 'LC_MESSAGES': 'C', 'LC_COLLATE': 'C', 'LC_TELEPHONE': 'C', 'LC_MONETARY': 'C', 'PWD': '/root', 'LC_NAME': 'C', 'MAIL': '/var/mail/root', 'LC_TIME': 'C', 'MACHTYPE': 'x86_64', 'PAGER': 'more'} DEBUG || stdout = -1 DEBUG || close_fds = True DEBUG || stdin = None DEBUG || cwd = /root [DEBUG ] stdout: git version 2.14.1 [DEBUG ] LazyLoaded git.latest [INFO ] Running state [[email protected]:sysadmins/app-metadata.git] at time 12:28:37.582848 [INFO ] Executing state git.latest for [email protected]:sysadmins/app-metadata.git [INFO ] Checking remote revision for [email protected]:sysadmins/app-metadata.git [INFO ] Executing command ['git', 'ls-remote', '[email protected]:sysadmins/app-metadata.git'] as user 'git' in directory '/home/git' ('DEBUG || cmd: ', ['git', 'ls-remote', '[email protected]:sysadmins/app-metadata.git']) DEBUG || shell = False DEBUG || stderr = -1 DEBUG || stdout = -1 DEBUG || bg = False DEBUG || with_communicate = True DEBUG || preexec_fn = <functools.partial object at 0x80de68368> DEBUG || env = {'LC_NUMERIC': 'C', 'GROUP': 'wheel', 'PERLBREW_PERL': 'perl-5.20.3', 'REMOTEHOST': '181.44.153.41', 'LC_IDENTIFICATION': 'C', 'LC_CTYPE': 'C', 'HOSTTYPE': 'FreeBSD', 'PERLBREW_MANPATH': '/opt/perl/perls/perl-5.20.3/man', 'TMOUT': '600', 'PERLBREW_BASHRC_VERSION': '0.80', 'LOGNAME': 'git', 'USER': 'git', 'TIMEOUT': '600', 'HOME': '/home/git', 'LC_PAPER': 'C', 'PATH': '/opt/perl/bin:/opt/perl/perls/perl-5.20.3/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/home/git/bin', 'PERLBREW_PATH': '/opt/perl/bin:/opt/perl/perls/perl-5.20.3/bin', 'TERM': 'xterm-256color', 'SHELL': '/usr/local/bin/bash', 'SHLVL': '2', 'BLOCKSIZE': 'K', 'EDITOR': 'vi', 'MANPATH': '/opt/perl/perls/perl-5.20.3/man:/usr/share/man:/usr/local/man:/usr/share/openssl/man:/usr/local/lib/perl5/site_perl/man:/usr/local/lib/perl5/5.24/perl/man', 'OSTYPE': 'FreeBSD', 'SUDO_USER': 'root', 'LC_MONETARY': 'C', 'USERNAME': 'root', 'VENDOR': 'amd', 'PERLBREW_ROOT': '/opt/perl', 'LC_ADDRESS': 'C', 'SUDO_UID': '0', 'PERLBREW_VERSION': '0.80', 'HOST': 'ip-10-0-1-183', 'ENV': '/home/git/.shrc', 'PERLBREW_HOME': '/home/git/.perlbrew', '_': '/bin/csh', 'SUDO_COMMAND': '/usr/local/bin/salt-call --config-dir=/tmp/kitchen/srv/salt --local state.apply metadata saltenv=appserver --log-level=all --log-file=/tmp/highstate.log --retcode-passthrough', 'SUDO_GID': '0', 'LC_MESSAGES': 'C', 'Handy bash(1) prompt: PS1="\\u@\\h \\w \\!$ "\n\t\t-- David Scheidt <[email protected]>\nGROUP': 'git', 'LC_COLLATE': 'C', 'PERLBREW_SKIP_INIT': '0', 'LC_TELEPHONE': 'C', 'LC_MEASUREMENT': 'C', 'PWD': '/home/git', 'LC_NAME': 'C', 'MAIL': '/var/mail/git', 'LC_TIME': 'C', 'MACHTYPE': 'x86_64', 'PAGER': 'more'} DEBUG || close_fds = True DEBUG || stdin = None DEBUG || timeout = None DEBUG || cwd = /home/git [ERROR ] An exception occurred in this state: Traceback (most recent call last): File "/usr/local/lib/python2.7/site-packages/salt/state.py", line 1750, in call **cdata['kwargs']) File "/usr/local/lib/python2.7/site-packages/salt/loader.py", line 1705, in wrapper return f(*args, **kwargs) File "/usr/local/lib/python2.7/site-packages/salt/states/git.py", line 717, in latest saltenv=__env__) File "/usr/local/lib/python2.7/site-packages/salt/modules/git.py", line 3307, in remote_refs saltenv=saltenv)['stdout'] File "/usr/local/lib/python2.7/site-packages/salt/modules/git.py", line 286, in _git_run **kwargs) File "/usr/local/lib/python2.7/site-packages/salt/modules/cmdmod.py", line 1665, in run_all **kwargs) File "/usr/local/lib/python2.7/site-packages/salt/modules/cmdmod.py", line 530, in _run proc = salt.utils.timed_subprocess.TimedProc(cmd, **kwargs) File "/usr/local/lib/python2.7/site-packages/salt/utils/timed_subprocess.py", line 42, in __init__ self.process = subprocess.Popen(args, **kwargs) File "/usr/local/lib/python2.7/subprocess.py", line 390, in __init__ errread, errwrite) File "/usr/local/lib/python2.7/subprocess.py", line 1025, in _execute_child raise child_exception ValueError: illegal environment variable name

('DEBUG || cmd: ', ['git', 'ls-remote', '[email protected]:sysadmins/app-metadata.git']) DEBUG || shell = False DEBUG || stderr = -1 DEBUG || stdout = -1 DEBUG || bg = False DEBUG || with_communicate = True DEBUG || preexec_fn = <functools.partial object at 0x80de6a310> DEBUG || env = {'LC_NUMERIC': 'C', 'GROUP': 'wheel', 'PERLBREW_PERL': 'perl-5.20.3', 'REMOTEHOST': '181.44.153.41', 'LC_IDENTIFICATION': 'C', 'To save disk space in your home directory, compress files you rarely\nuse with "gzip filename".\n\t\t-- Dru <[email protected]>\nGROUP': 'git', 'HOSTTYPE': 'FreeBSD', 'PERLBREW_MANPATH': '/opt/perl/perls/perl-5.20.3/man', 'TMOUT': '600', 'PERLBREW_BASHRC_VERSION': '0.80', 'LOGNAME': 'git', 'USER': 'git', 'TIMEOUT': '600', 'HOME': '/home/git', 'LC_PAPER': 'C', 'PATH': '/opt/perl/bin:/opt/perl/perls/perl-5.20.3/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/home/git/bin', 'PERLBREW_PATH': '/opt/perl/bin:/opt/perl/perls/perl-5.20.3/bin', 'TERM': 'xterm-256color', 'SHELL': '/usr/local/bin/bash', 'SHLVL': '2', 'BLOCKSIZE': 'K', 'EDITOR': 'vi', 'MANPATH': '/opt/perl/perls/perl-5.20.3/man:/usr/share/man:/usr/local/man:/usr/share/openssl/man:/usr/local/lib/perl5/site_perl/man:/usr/local/lib/perl5/5.24/perl/man', 'OSTYPE': 'FreeBSD', 'SUDO_USER': 'root', 'LC_MONETARY': 'C', 'USERNAME': 'root', 'VENDOR': 'amd', 'PERLBREW_ROOT': '/opt/perl', 'LC_ADDRESS': 'C', 'SUDO_UID': '0', 'PERLBREW_VERSION': '0.80', 'LC_CTYPE': 'C', 'HOST': 'ip-10-0-1-183', 'ENV': '/home/git/.shrc', 'PERLBREW_HOME': '/home/git/.perlbrew', '_': '/bin/csh', 'SUDO_COMMAND': '/usr/local/bin/salt-call --config-dir=/tmp/kitchen/srv/salt --local state.apply metadata saltenv=appserver --log-level=all --log-file=/tmp/highstate.log --retcode-passthrough', 'SUDO_GID': '0', 'LC_MESSAGES': 'C', 'LC_COLLATE': 'C', 'PERLBREW_SKIP_INIT': '0', 'LC_TELEPHONE': 'C', 'LC_MEASUREMENT': 'C', 'PWD': '/home/git', 'LC_NAME': 'C', 'MAIL': '/var/mail/git', 'LC_TIME': 'C', 'MACHTYPE': 'x86_64', 'PAGER': 'more'} DEBUG || close_fds = True DEBUG || stdin = None DEBUG || timeout = None DEBUG || cwd = /home/git [DEBUG ] stdout: f47f7785425107069792c2d43619d64fe52f42ba HEAD f47f7785425107069792c2d43619d64fe52f42ba refs/heads/master [DEBUG ] stderr: [TRACE ] Trying pysss.getgrouplist for 'git' [TRACE ] Trying generic group list for 'git' [TRACE ] Group list for user 'git': '['git', 'www']' [INFO ] Executing command ['git', 'for-each-ref', '--format', '%(refname:short)', 'refs/heads/'] as user 'git' in directory '/var/zxid/cot' ('DEBUG || cmd: ', ['git', 'for-each-ref', '--format', '%(refname:short)', 'refs/heads/']) DEBUG || shell = False DEBUG || stderr = -1 DEBUG || stdout = -1 DEBUG || bg = False DEBUG || with_communicate = True DEBUG || preexec_fn = <functools.partial object at 0x80de6a310> DEBUG || env = {'LC_NUMERIC': 'C', 'GROUP': 'wheel', 'PERLBREW_PERL': 'perl-5.20.3', 'REMOTEHOST': '181.44.153.41', 'LC_IDENTIFICATION': 'C', 'LC_CTYPE': 'C', 'HOSTTYPE': 'FreeBSD', 'PERLBREW_MANPATH': '/opt/perl/perls/perl-5.20.3/man', 'TMOUT': '600', 'PERLBREW_BASHRC_VERSION': '0.80', 'LOGNAME': 'git', 'USER': 'git', 'TIMEOUT': '600', 'HOME': '/home/git', 'LC_PAPER': 'C', 'PATH': '/opt/perl/bin:/opt/perl/perls/perl-5.20.3/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/home/git/bin', 'PERLBREW_PATH': '/opt/perl/bin:/opt/perl/perls/perl-5.20.3/bin', 'TERM': 'xterm-256color', 'SHELL': '/usr/local/bin/bash', 'SHLVL': '2', 'BLOCKSIZE': 'K', 'EDITOR': 'vi', 'MANPATH': '/opt/perl/perls/perl-5.20.3/man:/usr/share/man:/usr/local/man:/usr/share/openssl/man:/usr/local/lib/perl5/site_perl/man:/usr/local/lib/perl5/5.24/perl/man', 'OSTYPE': 'FreeBSD', 'SUDO_USER': 'root', 'LC_MONETARY': 'C', 'USERNAME': 'root', 'VENDOR': 'amd', 'You can use aliases to decrease the amount of typing you need to do to get\ncommands you commonly use. Examples of fairly popular aliases include (in\nBourne shell style, as in /bin/sh, bash, ksh, and zsh):\n\n\talias lf="ls -FA"\n\talias ll="ls -lA"\n\talias su="su -m"\n\nIn csh or tcsh, these would be\n\n\talias lf ls -FA\n\talias ll ls -lA\n\talias su su -m\n\nTo remove an alias, you can usually use \'unalias aliasname\'. To list all\naliases, you can usually type just \'alias\'.\nGROUP': 'git', 'PERLBREW_ROOT': '/opt/perl', 'LC_ADDRESS': 'C', 'SUDO_UID': '0', 'PERLBREW_VERSION': '0.80', 'HOST': 'ip-10-0-1-183', 'ENV': '/home/git/.shrc', 'PERLBREW_HOME': '/home/git/.perlbrew', '_': '/bin/csh', 'SUDO_COMMAND': '/usr/local/bin/salt-call --config-dir=/tmp/kitchen/srv/salt --local state.apply metadata saltenv=appserver --log-level=all --log-file=/tmp/highstate.log --retcode-passthrough', 'SUDO_GID': '0', 'LC_MESSAGES': 'C', 'LC_COLLATE': 'C', 'PERLBREW_SKIP_INIT': '0', 'LC_TELEPHONE': 'C', 'LC_MEASUREMENT': 'C', 'PWD': '/home/git', 'LC_NAME': 'C', 'MAIL': '/var/mail/git', 'LC_TIME': 'C', 'MACHTYPE': 'x86_64', 'PAGER': 'more'} DEBUG || close_fds = True DEBUG || stdin = None DEBUG || timeout = None DEBUG || cwd = /var/zxid/cot [ERROR ] Unexpected exception in git.latest state Traceback (most recent call last): File "/usr/local/lib/python2.7/site-packages/salt/states/git.py", line 826, in latest target, user=user, password=password) File "/usr/local/lib/python2.7/site-packages/salt/modules/git.py", line 2029, in list_branches ignore_retcode=ignore_retcode)['stdout'].splitlines() File "/usr/local/lib/python2.7/site-packages/salt/modules/git.py", line 286, in _git_run **kwargs) File "/usr/local/lib/python2.7/site-packages/salt/modules/cmdmod.py", line 1665, in run_all **kwargs) File "/usr/local/lib/python2.7/site-packages/salt/modules/cmdmod.py", line 530, in _run proc = salt.utils.timed_subprocess.TimedProc(cmd, **kwargs) File "/usr/local/lib/python2.7/site-packages/salt/utils/timed_subprocess.py", line 42, in __init__ self.process = subprocess.Popen(args, **kwargs) File "/usr/local/lib/python2.7/subprocess.py", line 390, in __init__ errread, errwrite) File "/usr/local/lib/python2.7/subprocess.py", line 1025, in _execute_child raise child_exception ValueError: illegal environment variable name [ERROR ] illegal environment variable name

@abednarik Thanks for the update and glad to see it's not a Salt bug!

For the record if any FreeBSD+SaltStack user needs to solve this a workaround we had to do on official FreeBSD AMI is this:

export FREEBSD_VERSION=`/bin/freebsd-version | /usr/bin/cut -f1-2 -d'-'`
export COMPONENT_URL="http://ftp.freebsd.org/pub/FreeBSD/releases/`uname -m`/$FREEBSD_VERSION"
su -m root -c 'cd / && fetch -o - $COMPONENT_URL/games.txz | tar -tzf - | xargs rm'

Thanks!

Using FreeBSD 11.1 (which apparently lacks games.txz) I had to use this:
export COMPONENT_URL="http://ftp.freebsd.org/pub/FreeBSD/releases/uname -m/10.3-RELEASE"

Was this page helpful?
0 / 5 - 0 ratings