#!/usr/bin/env bash # Copyright (c) 2025 Nils Stein (@mietzen) # Copyright (c) 2025 Ansible Project # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt) # SPDX-License-Identifier: GPL-3.0-or-later # Shell script to mock proxmox pct behaviour >&2 echo "[DEBUG] INPUT: $@" pwd="$(pwd)" # Get quoted parts and restore quotes declare -a cmd=() for arg in "$@"; do if [[ $arg =~ [[:space:]] ]]; then arg="'$arg'" fi cmd+=("$arg") done cmd="${cmd[@]:3}" vmid="${@:2:1}" >&2 echo "[INFO] MOCKING: pct ${@:1:3} ${cmd}" tmp_dir="/tmp/ansible-remote/proxmox_pct_remote/integration_test/ct_${vmid}" mkdir -p "$tmp_dir" >&2 echo "[INFO] PWD: $tmp_dir" >&2 echo "[INFO] CMD: ${cmd}" cd "$tmp_dir" eval "${cmd}" cd "$pwd"