Skip to content

Instantly share code, notes, and snippets.

@redshiftzero
Last active May 12, 2017 22:48
Show Gist options
  • Save redshiftzero/b7dee2ae9668023e5c7fadfa6f9b3056 to your computer and use it in GitHub Desktop.
Save redshiftzero/b7dee2ae9668023e5c7fadfa6f9b3056 to your computer and use it in GitHub Desktop.
============================================== FAILURES ===============================================
___________________________ test_app_iptables_rules[ansible://app-staging] ____________________________
[gw1] darwin -- Python 2.7.12 /usr/local/opt/python/bin/python2.7
SystemInfo = <testinfra.modules.base.SystemInfo object at 0x10ee32dd0>
Command = <command>, Sudo = <sudo>
def test_app_iptables_rules(SystemInfo, Command, Sudo):
# Build a dict of variables to pass to jinja for iptables comparison
kwargs = dict(
mon_ip=securedrop_test_vars.mon_ip,
default_interface = Command.check_output("ip r | head -n 1 | awk '{ print $5 }'"),
tor_user_id = Command.check_output("id -u debian-tor"),
securedrop_user_id = Command.check_output("id -u www-data"),
ssh_group_gid = Command.check_output("getent group ssh | cut -d: -f3"),
dns_server = securedrop_test_vars.dns_server)
# Build iptables scrape cmd, purge comments + counters
iptables = "iptables-save | sed 's/ \[[0-9]*\:[0-9]*\]//g' | egrep -v '^#'"
environment = os.environ.get("CI_SD_ENV")
iptables_file = "{}/iptables-app-{}.j2".format(
os.path.dirname(os.path.abspath(__file__)),
environment)
# template out a local iptables jinja file
> jinja_iptables = Template(open(iptables_file,'r').read())
E IOError: [Errno 2] No such file or directory: '/Users/redshiftzero/Documents/FPFGithub/conor-ossec-reboot/securedrop/testinfra/app/iptables-app-None.j2'
testinfra/app/test_network.py:29: IOError
---------------------------------------- Captured stderr call -----------------------------------------
INFO:testinfra:RUN Ansible(u'shell', "ip r | head -n 1 | awk '{ print $5 }'", {}): {'_ansible_no_log': False,
'_ansible_parsed': True,
u'changed': True,
u'cmd': u"ip r | head -n 1 | awk '{ print $5 }'",
u'delta': u'0:00:00.014982',
u'end': u'2017-05-12 22:35:57.033095',
'invocation': {u'module_args': {u'_raw_params': u"ip r | head -n 1 | awk '{ print $5 }'",
u'_uses_shell': True,
u'chdir': None,
u'creates': None,
u'executable': None,
u'removes': None,
u'warn': True},
'module_name': u'command'},
u'rc': 0,
u'start': u'2017-05-12 22:35:57.018113',
u'stderr': u'',
u'stdout': u'eth0',
'stdout_lines': [u'eth0'],
u'warnings': []}
INFO:testinfra:RUN CommandResult(command="ip r | head -n 1 | awk '{ print $5 }'", exit_status=0, stdout='eth0', stderr=u'')
INFO:testinfra:RUN Ansible(u'shell', 'id -u debian-tor', {}): {'_ansible_no_log': False,
'_ansible_parsed': True,
u'changed': True,
u'cmd': u'id -u debian-tor',
u'delta': u'0:00:00.015115',
u'end': u'2017-05-12 22:35:57.860169',
'invocation': {u'module_args': {u'_raw_params': u'id -u debian-tor',
u'_uses_shell': True,
u'chdir': None,
u'creates': None,
u'executable': None,
u'removes': None,
u'warn': True},
'module_name': u'command'},
u'rc': 0,
u'start': u'2017-05-12 22:35:57.845054',
u'stderr': u'',
u'stdout': u'107',
'stdout_lines': [u'107'],
u'warnings': []}
INFO:testinfra:RUN CommandResult(command='id -u debian-tor', exit_status=0, stdout='107', stderr=u'')
INFO:testinfra:RUN Ansible(u'shell', 'id -u www-data', {}): {'_ansible_no_log': False,
'_ansible_parsed': True,
u'changed': True,
u'cmd': u'id -u www-data',
u'delta': u'0:00:00.031042',
u'end': u'2017-05-12 22:35:58.936802',
'invocation': {u'module_args': {u'_raw_params': u'id -u www-data',
u'_uses_shell': True,
u'chdir': None,
u'creates': None,
u'executable': None,
u'removes': None,
u'warn': True},
'module_name': u'command'},
u'rc': 0,
u'start': u'2017-05-12 22:35:58.905760',
u'stderr': u'',
u'stdout': u'33',
'stdout_lines': [u'33'],
u'warnings': []}
INFO:testinfra:RUN CommandResult(command='id -u www-data', exit_status=0, stdout='33', stderr=u'')
INFO:testinfra:RUN Ansible(u'shell', 'getent group ssh | cut -d: -f3', {}): {'_ansible_no_log': False,
'_ansible_parsed': True,
u'changed': True,
u'cmd': u'getent group ssh | cut -d: -f3',
u'delta': u'0:00:00.013183',
u'end': u'2017-05-12 22:35:59.842916',
'invocation': {u'module_args': {u'_raw_params': u'getent group ssh | cut -d: -f3',
u'_uses_shell': True,
u'chdir': None,
u'creates': None,
u'executable': None,
u'removes': None,
u'warn': True},
'module_name': u'command'},
u'rc': 0,
u'start': u'2017-05-12 22:35:59.829733',
u'stderr': u'',
u'stdout': u'108',
'stdout_lines': [u'108'],
u'warnings': []}
INFO:testinfra:RUN CommandResult(command='getent group ssh | cut -d: -f3', exit_status=0, stdout='108', stderr=u'')
======================================= pytest-warning summary ========================================
WP1 None Module already imported so can not be re-written: testinfra
=========== 1 failed, 276 passed, 2 skipped, 1 xpassed, 1 pytest-warnings in 202.02 seconds ===========
Traceback (most recent call last):
File "./testinfra/test.py", line 129, in <module>
run_testinfra(target_host)
File "./testinfra/test.py", line 126, in run_testinfra
subprocess.check_call(testinfra_command)
File "/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 541, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['testinfra', '-vv', '-n', 'auto', '--connection', 'ansible', '--ansible-inventory', '.vagrant/provisioners/ansible/inventory/vagrant_ansible_inventory', '--hosts', 'app-staging', 'testinfra/app', 'testinfra/app-code', 'testinfra/common', 'testinfra/development/test_xvfb.py']' returned non-zero exit status 1
============================================== FAILURES ===============================================
___________________________ test_mon_iptables_rules[ansible://mon-staging] ____________________________
[gw3] darwin -- Python 2.7.12 /usr/local/opt/python/bin/python2.7
SystemInfo = <testinfra.modules.base.SystemInfo object at 0x10d857890>
Command = <command>, Sudo = <sudo>
def test_mon_iptables_rules(SystemInfo, Command, Sudo):
app_ip = securedrop_test_vars.app_ip
# Build a dict of variables to pass to jinja for iptables comparison
kwargs = dict(
app_ip=app_ip,
default_interface = Command.check_output("ip r | head -n 1 | awk '{ print $5 }'"),
tor_user_id = Command.check_output("id -u debian-tor"),
ssh_group_gid = Command.check_output("getent group ssh | cut -d: -f3"),
postfix_user_id = Command.check_output("id -u postfix"),
dns_server = securedrop_test_vars.dns_server)
# Build iptables scrape cmd, purge comments + counters
iptables = "iptables-save | sed 's/ \[[0-9]*\:[0-9]*\]//g' | egrep -v '^#'"
environment = os.environ.get("CI_SD_ENV")
iptables_file = "{}/iptables-mon-{}.j2".format(
os.path.dirname(os.path.abspath(__file__)),
environment)
# template out a local iptables jinja file
> jinja_iptables = Template(open(iptables_file,'r').read())
E IOError: [Errno 2] No such file or directory: '/Users/redshiftzero/Documents/FPFGithub/conor-ossec-reboot/securedrop/testinfra/mon/iptables-mon-None.j2'
testinfra/mon/test_network.py:30: IOError
---------------------------------------- Captured stderr call -----------------------------------------
INFO:testinfra:RUN Ansible(u'shell', "ip r | head -n 1 | awk '{ print $5 }'", {}): {'_ansible_no_log': False,
'_ansible_parsed': True,
u'changed': True,
u'cmd': u"ip r | head -n 1 | awk '{ print $5 }'",
u'delta': u'0:00:00.029710',
u'end': u'2017-05-12 22:46:26.679690',
'invocation': {u'module_args': {u'_raw_params': u"ip r | head -n 1 | awk '{ print $5 }'",
u'_uses_shell': True,
u'chdir': None,
u'creates': None,
u'executable': None,
u'removes': None,
u'warn': True},
'module_name': u'command'},
u'rc': 0,
u'start': u'2017-05-12 22:46:26.649980',
u'stderr': u'',
u'stdout': u'eth0',
'stdout_lines': [u'eth0'],
u'warnings': []}
INFO:testinfra:RUN CommandResult(command="ip r | head -n 1 | awk '{ print $5 }'", exit_status=0, stdout='eth0', stderr=u'')
INFO:testinfra:RUN Ansible(u'shell', 'id -u debian-tor', {}): {'_ansible_no_log': False,
'_ansible_parsed': True,
u'changed': True,
u'cmd': u'id -u debian-tor',
u'delta': u'0:00:00.016996',
u'end': u'2017-05-12 22:46:27.705155',
'invocation': {u'module_args': {u'_raw_params': u'id -u debian-tor',
u'_uses_shell': True,
u'chdir': None,
u'creates': None,
u'executable': None,
u'removes': None,
u'warn': True},
'module_name': u'command'},
u'rc': 0,
u'start': u'2017-05-12 22:46:27.688159',
u'stderr': u'',
u'stdout': u'107',
'stdout_lines': [u'107'],
u'warnings': []}
INFO:testinfra:RUN CommandResult(command='id -u debian-tor', exit_status=0, stdout='107', stderr=u'')
INFO:testinfra:RUN Ansible(u'shell', 'getent group ssh | cut -d: -f3', {}): {'_ansible_no_log': False,
'_ansible_parsed': True,
u'changed': True,
u'cmd': u'getent group ssh | cut -d: -f3',
u'delta': u'0:00:00.036264',
u'end': u'2017-05-12 22:46:28.431817',
'invocation': {u'module_args': {u'_raw_params': u'getent group ssh | cut -d: -f3',
u'_uses_shell': True,
u'chdir': None,
u'creates': None,
u'executable': None,
u'removes': None,
u'warn': True},
'module_name': u'command'},
u'rc': 0,
u'start': u'2017-05-12 22:46:28.395553',
u'stderr': u'',
u'stdout': u'108',
'stdout_lines': [u'108'],
u'warnings': []}
INFO:testinfra:RUN CommandResult(command='getent group ssh | cut -d: -f3', exit_status=0, stdout='108', stderr=u'')
INFO:testinfra:RUN Ansible(u'shell', 'id -u postfix', {}): {'_ansible_no_log': False,
'_ansible_parsed': True,
u'changed': True,
u'cmd': u'id -u postfix',
u'delta': u'0:00:00.018680',
u'end': u'2017-05-12 22:46:29.283719',
'invocation': {u'module_args': {u'_raw_params': u'id -u postfix',
u'_uses_shell': True,
u'chdir': None,
u'creates': None,
u'executable': None,
u'removes': None,
u'warn': True},
'module_name': u'command'},
u'rc': 0,
u'start': u'2017-05-12 22:46:29.265039',
u'stderr': u'',
u'stdout': u'108',
'stdout_lines': [u'108'],
u'warnings': []}
INFO:testinfra:RUN CommandResult(command='id -u postfix', exit_status=0, stdout='108', stderr=u'')
======================================= pytest-warning summary ========================================
WP1 None Module already imported so can not be re-written: testinfra
===== 1 failed, 145 passed, 1 skipped, 3 xfailed, 2 xpassed, 1 pytest-warnings in 105.14 seconds ======
Traceback (most recent call last):
File "./testinfra/test.py", line 129, in <module>
run_testinfra(target_host)
File "./testinfra/test.py", line 126, in run_testinfra
subprocess.check_call(testinfra_command)
File "/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 541, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['testinfra', '-vv', '-n', 'auto', '--connection', 'ansible', '--ansible-inventory', '.vagrant/provisioners/ansible/inventory/vagrant_ansible_inventory', '--hosts', 'mon-staging', 'testinfra/mon', 'testinfra/common']' returned non-zero exit status 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment