Skip to content
This repository has been archived by the owner on Jan 8, 2023. It is now read-only.

Commit

Permalink
Fixing podman flags order sequence in create task (#36)
Browse files Browse the repository at this point in the history
These changes moves the podman flags:
`--storage-opt`, `--storage-driver` and `--cgroup-manager` to be called
before the `run` command.
This fix a execution fail when using some of those flags in the
`molecule.yml` file.

e.g:

this:
```bash
podman --cgroup-manager=cgroupfs
--storage-opt=overlay.mount_program=/usr/bin/fuse-overlayfs
--storage-driver=overlay run -d --name node.local
--privileged=True --volume /dev/fuse:/dev/fuse:rw --tmpfs=/run
--tmpfs=/tmp --hostname=node.local
docker.io/pycontribs/centos:8 /sbin/init
```

instead of this:
```bash
podman run -d --name node.local  --privileged=True
--volume /dev/fuse:/dev/fuse:rw --tmpfs=/run --tmpfs=/tmp
--hostname=node.local --cgroup-manager=cgroupfs
--storage-opt=overlay.mount_program=/usr/bin/fuse-overlayfs
--storage-driver=overlay
docker.io/pycontribs/centos:8 /sbin/init
```
  • Loading branch information
mrbrandao authored Jun 16, 2021
1 parent 7667970 commit 38b16b8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/molecule_podman/playbooks/create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,11 @@

- name: Create molecule instance(s)
command: >
podman run
podman
{% if item.cgroup_manager is defined %}--cgroup-manager={{ item.cgroup_manager }}{% endif %}
{% if item.storage_opt is defined %}--storage-opt={{ item.storage_opt }}{% endif %}
{% if item.storage_driver is defined %}--storage-driver={{ item.storage_driver }}{% endif %}
run
-d
--name "{{ item.name }}"
{% if item.pid_mode is defined %}--pid={{ item.pid_mode }}{% endif %}
Expand All @@ -122,9 +126,6 @@
{% if item.network is defined %}--network={{ item.network }}{% endif %}
{% if item.etc_hosts is defined %}{% for i,k in item.etc_hosts.items() %}--add-host {{ i }}:{{ k }} {% endfor %}{% endif %}
{% if item.hostname is defined %}--hostname={{ item.hostname }}{% elif item.name is defined %}--hostname={{ item.name }}{% endif %}
{% if item.cgroup_manager is defined %}--cgroup-manager={{ item.cgroup_manager }}{% endif %}
{% if item.storage_opt is defined %}--storage-opt={{ item.storage_opt }}{% endif %}
{% if item.storage_driver is defined %}--storage-driver={{ item.storage_driver }}{% endif %}
{% if item.systemd is defined %}--systemd={{ item.systemd }}{% endif %}
{{ item.pre_build_image | default(false) | ternary('', 'molecule_local/') }}{{ item.image }}
{{ (command_directives_dict | default({}))[item.name] | default('') }}
Expand Down

0 comments on commit 38b16b8

Please sign in to comment.