Skip to content
This repository has been archived by the owner on Mar 23, 2019. It is now read-only.

Using idea to remote debug ansible container

Vyacheslav edited this page Nov 15, 2018 · 3 revisions

Recent changes to ansible-container codebase allow contributors to use their IDE to do step by step tracing of the ansible-container code with help remote debugging.

In order to activate this possibility you need

a) Server side remote debugging helper pycharm-debug.egg in the root of your repo. It is distributed as part of PyCharm in its debug-eggs directory. See https://www.jetbrains.com/help/pycharm/remote-debugging.html for additional details

b) Create python remote debug configuration, call it "conductor" with following parameters:

hostname: host.docker.internal

port: 55507

port mappings: =/_ansible

Per code below https://github.com/ansible/ansible-container/pull/949/files#diff-5aa273573aa8d18556fb9fe77678a9e9R13 , in case if environment variable REMOTE_DEBUGGINGis set, you will get debugger available.

c) Create local debugging configuration for play you are working on

Script path: /_ansible_container.py

Parameters: --debug build

Working directory: path to project with issue, like /mnt/hdd/home/slavko/softasap/opensource/ac-bug-944-poc/site1

where _ansible-container.py is script like

# -*- coding: utf-8 -*-
import re
import sys

from container.cli import host_commandline

if __name__ == '__main__':
  sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
  sys.exit(host_commandline())
Clone this wiki locally