Skip to content

Commit

Permalink
Enable tracing and log collection in the vcsim container
Browse files Browse the repository at this point in the history
  • Loading branch information
jctanner committed Oct 17, 2017
1 parent e5eedfe commit cc287da
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
16 changes: 15 additions & 1 deletion test/utils/docker/vcenter-simulator/flask_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,16 @@ def m_index():
return 'vcsim controller'


@app.route('/log')
def get_log():
"""Read and return the vcsim log"""
fdata = ''
if os.path.isfile('vcsim.log'):
with open('vcsim.log', 'rb') as f:
fdata = f.read()
return fdata


@app.route('/kill/<int:number>')
def kill_one(number):
"""Kill any arbitrary process id"""
Expand Down Expand Up @@ -133,6 +143,10 @@ def spawn_vcsim():
'%s:%s' % (hostname, port),
]

# trace soap requests+responses
if trace:
cmd.append('-trace')

# esx only allows certain arguments
if request.args.get('esx'):
cmd.append('-esx')
Expand All @@ -151,7 +165,7 @@ def spawn_vcsim():
default = request.args.get(name)
cmd.append('-%s=%s' % (name, default))
cmd = ' '.join(cmd)
cmd += ' 2>&1 > vcsim.log'
cmd += ' > vcsim.log 2>&1'

# run it with environment settings
p = subprocess.Popen(
Expand Down
2 changes: 1 addition & 1 deletion test/utils/docker/vcenter-simulator/make.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

docker build -t ansible:vcenter-simulator .
docker build --no-cache -t ansible:vcenter-simulator .

0 comments on commit cc287da

Please sign in to comment.