Skip to content

Instantly share code, notes, and snippets.

View apatard's full-sized avatar

Arnaud Patard apatard

View GitHub Profile
@apatard
apatard / t.sh
Created July 11, 2023 13:30
molecule pr3957
mkdir -p acme.myrole
cat > acme.myrole/.yamllint <<EOF
---
# Based on ansible-lint config
extends: default
rules:
braces:
max-spaces-inside: 1
level: error
scdaemon: Allow to switch between piv and openpgp apps for Nitrokey 3
Nitrokey 3 token have a piv and openpgp applications, like Yubikey.
So add minimal glue to allow switching between them.
Tested with Nitrokey 3 firmware v1.3.1-test.20230417 and
gpg --card-status && pkcs11-tool --list-slots && gpg --card-status.
The scdaemon configuration was:
@@ -114,16 +114,14 @@ def teardown():
# TEST-LEVEL SETUP AND TEARDOWN
-@pytest.fixture(scope="module")
-def vm(request: FixtureRequest, vagrantfile=None) -> Generator[None, None, None]:
+@pytest.fixture(scope="function")
+def vm(request: FixtureRequest) -> Generator[None, None, None]:
"""
Make and return a function that sets up the temporary directory with a
@apatard
apatard / test.sh
Created April 23, 2021 12:49
weird ansible-lint failure
#!/bin/bash
set -x
set -e
mkdir test
cd test
git init
mkdir -p molecule/tasks/
cat > test.yml <<EOF
---
- hosts: all
import sys
import os
from enrich.console import Console
def should_do_markup():
"""Decide about use of ANSI colors."""
term = os.environ.get("TERM", "")
if "xterm" in term:
return True
if term == "dumb":
diff --git a/tools/test-setup.sh b/tools/test-setup.sh
index 4d2b09d..9c12333 100755
--- a/tools/test-setup.sh
+++ b/tools/test-setup.sh
@@ -22,7 +22,18 @@ sudo $PYTHON -m pip install -U tox
# === LIBVIRT SETUP ===
sudo systemctl enable --now libvirtd
+sudo sed \
+ -e 's!^[# ]*unix_sock_rw_perms = .*$!unix_sock_rw_perms = "0777"!g' \
diff --git a/molecule_vagrant/modules/vagrant.py b/molecule_vagrant/modules/vagrant.py
index 4fdeae7..f8fad23 100644
--- a/molecule_vagrant/modules/vagrant.py
+++ b/molecule_vagrant/modules/vagrant.py
@@ -35,7 +35,6 @@ import subprocess
import sys
import molecule
-import molecule.config
import molecule.util
@apatard
apatard / test.patch
Created July 2, 2020 12:24
[UNTESTED] molecule-vagrant vs hyperv
diff --git a/molecule_vagrant/modules/vagrant.py b/molecule_vagrant/modules/vagrant.py
index 4fdeae7..133c754 100644
--- a/molecule_vagrant/modules/vagrant.py
+++ b/molecule_vagrant/modules/vagrant.py
@@ -333,6 +333,35 @@ Vagrant.configure('2') do |config|
end
end
+ ##
+ # hyperv