1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Enable tracing and log collection in the vcsim container

This commit is contained in:
James Tanner 2017-10-16 12:05:12 -04:00 committed by jctanner
parent e5eedfe4b8
commit cc287daa3b
2 changed files with 16 additions and 2 deletions

View file

@ -41,6 +41,16 @@ def m_index():
return 'vcsim controller' 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>') @app.route('/kill/<int:number>')
def kill_one(number): def kill_one(number):
"""Kill any arbitrary process id""" """Kill any arbitrary process id"""
@ -133,6 +143,10 @@ def spawn_vcsim():
'%s:%s' % (hostname, port), '%s:%s' % (hostname, port),
] ]
# trace soap requests+responses
if trace:
cmd.append('-trace')
# esx only allows certain arguments # esx only allows certain arguments
if request.args.get('esx'): if request.args.get('esx'):
cmd.append('-esx') cmd.append('-esx')
@ -151,7 +165,7 @@ def spawn_vcsim():
default = request.args.get(name) default = request.args.get(name)
cmd.append('-%s=%s' % (name, default)) cmd.append('-%s=%s' % (name, default))
cmd = ' '.join(cmd) cmd = ' '.join(cmd)
cmd += ' 2>&1 > vcsim.log' cmd += ' > vcsim.log 2>&1'
# run it with environment settings # run it with environment settings
p = subprocess.Popen( p = subprocess.Popen(

View file

@ -1,3 +1,3 @@
#!/bin/bash #!/bin/bash
docker build -t ansible:vcenter-simulator . docker build --no-cache -t ansible:vcenter-simulator .