Skip to content

Commit 5e281d0

Browse files
committed
Improve smash config creation
1 parent aac4b28 commit 5e281d0

4 files changed

Lines changed: 36 additions & 38 deletions

File tree

templates/github/.ci/ansible/start_container.yaml

Lines changed: 35 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,26 @@
11
# Ansible playbook to start the pulp service container and its supporting services
22
---
3-
- hosts: localhost
3+
- hosts: "localhost"
44
gather_facts: false
55
vars_files:
6-
- vars/main.yaml
6+
- "vars/main.yaml"
77
tasks:
88
- name: "Create Settings Directories"
9-
file:
9+
ansible.builtin.file:
1010
path: "{{ item }}"
11-
state: directory
11+
state: "directory"
1212
mode: "0755"
1313
loop:
14-
- settings
15-
- ssh
16-
- ~/.config/pulp_smash
14+
- "settings"
1715

1816
- name: "Generate Pulp Settings"
1917
template:
20-
src: settings.py.j2
21-
dest: settings/settings.py
22-
23-
- name: "Configure pulp-smash"
24-
copy:
25-
src: smash-config.json
26-
dest: ~/.config/pulp_smash/settings.json
18+
src: "settings.py.j2"
19+
dest: "settings/settings.py"
2720

2821
- name: "Setup docker networking"
2922
docker_network:
30-
name: pulp_ci_bridge
23+
name: "pulp_ci_bridge"
3124

3225
- name: "Start Service Containers"
3326
docker_container:
@@ -37,24 +30,24 @@
3730
recreate: true
3831
privileged: true
3932
networks:
40-
- name: pulp_ci_bridge
33+
- name: "pulp_ci_bridge"
4134
aliases: "{{ item.name }}"
4235
volumes: "{{ item.volumes | default(omit) }}"
4336
env: "{{ item.env | default(omit) }}"
4437
command: "{{ item.command | default(omit) }}"
45-
state: started
38+
state: "started"
4639
loop: "{{ services | default([]) }}"
4740

4841
- name: "Retrieve Docker Network Info"
4942
docker_network_info:
50-
name: pulp_ci_bridge
51-
register: pulp_ci_bridge_info
43+
name: "pulp_ci_bridge"
44+
register: "pulp_ci_bridge_info"
5245

5346
- name: "Update /etc/hosts"
5447
lineinfile:
55-
path: /etc/hosts
48+
path: "/etc/hosts"
5649
regexp: "\\s{{ item.value.Name }}\\s*$"
57-
line: "{{ item.value.IPv4Address | ipaddr('address') }}\t{{ item.value.Name }}"
50+
line: "{{ item.value.IPv4Address | ansible.utils.ipaddr('address') }}\t{{ item.value.Name }}"
5851
loop: "{{ pulp_ci_bridge_info.network.Containers | dict2items }}"
5952
become: true
6053

@@ -63,19 +56,19 @@
6356
aws_access_key: "{{ minio_access_key }}"
6457
aws_secret_key: "{{ minio_secret_key }}"
6558
s3_url: "http://minio:9000"
66-
region: eu-central-1
67-
name: pulp3
68-
state: present
69-
when: s3_test | default(false)
59+
region: "eu-central-1"
60+
name: "pulp3"
61+
state: "present"
62+
when: "s3_test | default(false)"
7063

7164
- block:
7265
- name: "Wait for Pulp"
7366
uri:
7467
url: "http://pulp{{ lookup('env', 'PULP_API_ROOT') | default('\/pulp\/', True) }}api/v3/status/"
75-
follow_redirects: all
76-
validate_certs: no
77-
register: result
78-
until: result.status == 200
68+
follow_redirects: "all"
69+
validate_certs: "no"
70+
register: "result"
71+
until: "result.status == 200"
7972
retries: 12
8073
delay: 5
8174
rescue:
@@ -86,7 +79,7 @@
8679
- name: "Check version of component being tested"
8780
assert:
8881
that:
89-
- (result.json.versions | items2dict(key_name="component", value_name="version"))[item.app_label] | canonical_semver == (component_version | canonical_semver)
82+
- "(result.json.versions | items2dict(key_name='component', value_name='version'))[item.app_label] | canonical_semver == (component_version | canonical_semver)"
9083
fail_msg: |
9184
Component {{ item.app_label }} was expected to be installed in version {{ component_version }}.
9285
Instead it is reported as version {{ (result.json.versions | items2dict(key_name="component", value_name="version"))[item.app_label] }}.
@@ -100,9 +93,20 @@
10093
login admin
10194
password password
10295
103-
- hosts: pulp
96+
- hosts: "pulp"
10497
gather_facts: false
10598
tasks:
99+
- name: "Create directory for pulp-smash config"
100+
ansible.builtin.file:
101+
path: "/var/lib/pulp/.config/pulp_smash/"
102+
state: "directory"
103+
mode: "0755"
104+
105+
- name: "Configure pulp-smash"
106+
ansible.builtin.copy:
107+
src: "smash-config.json"
108+
dest: "/var/lib/pulp/.config/pulp_smash/settings.json"
109+
106110
- name: "Set pulp admin password"
107111
command:
108112
cmd: "pulpcore-manager reset-admin-password --password password"

templates/github/.github/workflows/scripts/before_install.sh.j2

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,6 @@ services:
9292
image: "pulp:ci_build"
9393
volumes:
9494
- "./settings:/etc/pulp"
95-
- "./ssh:/keys/"
96-
- "~/.config:/var/lib/pulp/.config"
9795
- "../../../pulp-openapi-generator:/root/pulp-openapi-generator"
9896
env:
9997
PULP_WORKERS: "4"

templates/github/.github/workflows/scripts/before_script.sh.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ fi
1818
# Developers often want to know the final pulp config
1919
echo
2020
echo "# Pulp config:"
21-
tail -v -n +1 .ci/ansible/settings/settings.* ~/.config/pulp_smash/settings.json
21+
tail -v -n +1 .ci/ansible/settings/settings.*
2222

2323
echo
2424
echo "# Containerfile:"

templates/github/.github/workflows/scripts/install.sh.j2

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,6 @@ cp ~/.config/pulp/cli.toml "${REPO_ROOT}/../{{ cli_package }}/tests/cli.toml"
4343
ansible-playbook build_container.yaml
4444
ansible-playbook start_container.yaml
4545

46-
# .config needs to be accessible by the pulp user in the container, but some
47-
# files will likely be modified on the host by post/pre scripts.
48-
chmod 777 ~/.config/pulp_smash/
49-
chmod 666 ~/.config/pulp_smash/settings.json
5046
{% if test_cli -%}
5147
# Plugins often write to ~/.config/pulp/cli.toml from the host
5248
chmod 777 ~/.config/pulp

0 commit comments

Comments
 (0)