diff --git a/Makefile b/Makefile index affa1db..89322ab 100644 --- a/Makefile +++ b/Makefile @@ -93,7 +93,7 @@ install-deps: setup-phpipam: test-setup docker-compose -f tests/docker/docker-compose.yml up -d - sh tests/docker/setup_database.sh + sh tests/docker/setup_phpipam.sh FORCE: diff --git a/README.md b/README.md index 46b19c4..3e6ceba 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,34 @@ The following dependencies have to be fulfiled by the Ansible controller. * ipaddress * phpypam>=1.0.0 +## Compatibility notice + +To ensure `phpipam-ansible-modules` work correctly with phpIPAM versions 1.7 and above, you need to modify the phpIPAM configuration to stringify API results. This is crucial because newer phpIPAM versions might return numerical values directly, which the Ansible modules might expect as strings. + +Here's how to implement the workaround: + +**1. Modify phpIPAM Configuration** + +You need to set the `api_stringify_results` variable to `true` in your phpIPAM configuration. This change should be made in the `config.php` file, which is typically located in the phpIPAM installation directory (e.g., `/var/www/html/phpipam/config.php` or `/var/www/phpipam/config.php`). + +Add or modify the following line in your `config.php` file: + +``` + +``` ## Need help? If you’ve found any issues in this release please head over to github and open a bug so we can take a look. diff --git a/tests/docker/docker-compose.yml b/tests/docker/docker-compose.yml index 2596560..251f7a7 100644 --- a/tests/docker/docker-compose.yml +++ b/tests/docker/docker-compose.yml @@ -1,4 +1,3 @@ -version: '3' services: phpipam: image: "phpipam/phpipam-www:${PHPIPAM_VERSION:-v1.4.4}" diff --git a/tests/docker/setup_database.sh b/tests/docker/setup_phpipam.sh similarity index 79% rename from tests/docker/setup_database.sh rename to tests/docker/setup_phpipam.sh index 82d684f..d28896d 100644 --- a/tests/docker/setup_database.sh +++ b/tests/docker/setup_phpipam.sh @@ -16,6 +16,11 @@ fi if "${DOCKER_CMD}" ps | grep -q phpipam_test_webserver && ! eval "${MYSQL_PING}" ; then + if [[ $(echo "${PHPIPAM_VERSION:-v1.4.4}" | sed -E 's/v[0-9]?.([0-9]?).[0-9]?/\1/g') -ge 7 ]] ; then + info "Running version 1.7.0 or above, patching config" + ${DOCKER_CMD} exec -t phpipam_test_webserver sh -c 'sed -i "s/api_stringify_results = false/api_stringify_results = true/g" /phpipam/config.dist.php' + fi + info -n "Waiting for database connection " while ! eval "${MYSQL_PING}" ; do info -n "." @@ -44,8 +49,8 @@ if [[ $(mysqlshow -u root -prootpw -h 127.0.0.1 -P 3306 phpipam 2>/dev/null | wc else - info "Detabase already initiated" && exit 0 + info "Database already initiated" && exit 0 fi -info "Database initialisation $result" +info "Database initialization $result"