Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit eb36b59

Browse files
committedJan 12, 2021
salt/volumes: Flatten directory structure
This will simplify the introduction of other states depending on `.installed`, into which we move the systemd unit template and cleanup script creation. See: scality#2982
1 parent f25d942 commit eb36b59

File tree

7 files changed

+27
-26
lines changed

7 files changed

+27
-26
lines changed
 

‎buildchain/buildchain/salt_tree.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -670,11 +670,11 @@ def _get_parts(self) -> Iterator[str]:
670670
Path('salt/metalk8s/utils/httpd-tools/installed.sls'),
671671

672672
Path('salt/metalk8s/volumes/init.sls'),
673-
Path('salt/metalk8s/volumes/prepared/init.sls'),
674-
Path('salt/metalk8s/volumes/prepared/installed.sls'),
675-
Path('salt/metalk8s/volumes/prepared/files/metalk8s-sparse-volume@.service'),
676-
Path('salt/metalk8s/volumes/prepared/files/sparse_volume_cleanup.py'),
677-
Path('salt/metalk8s/volumes/unprepared/init.sls'),
673+
Path('salt/metalk8s/volumes/installed.sls'),
674+
Path('salt/metalk8s/volumes/prepared.sls'),
675+
Path('salt/metalk8s/volumes/unprepared.sls'),
676+
Path('salt/metalk8s/volumes/files/metalk8s-sparse-volume@.service'),
677+
Path('salt/metalk8s/volumes/files/sparse_volume_cleanup.py'),
678678

679679
Path('salt/_auth/kubernetes_rbac.py'),
680680

‎salt/metalk8s/volumes/prepared/installed.sls ‎salt/metalk8s/volumes/installed.sls

+21
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,24 @@ Ensure Python 3 is available:
2323
test.fail_without_changes:
2424
- comment: Could not find a working Python 3 installation
2525
- unless: /usr/bin/env python3 --version
26+
27+
Create the sparse file directory:
28+
file.directory:
29+
- name: /var/lib/metalk8s/storage/sparse/
30+
- makedirs: True
31+
32+
Set up systemd template unit for sparse loop device provisioning:
33+
file.managed:
34+
- name: /etc/systemd/system/metalk8s-sparse-volume@.service
35+
- source: salt://{{ slspath }}/files/metalk8s-sparse-volume@.service
36+
- user: root
37+
- group : root
38+
- mode: 644
39+
40+
Install clean-up script:
41+
file.managed:
42+
- name: /usr/local/libexec/metalk8s-sparse-volume-cleanup
43+
- source: salt://{{ slspath }}/files/sparse_volume_cleanup.py
44+
- user: root
45+
- group : root
46+
- mode: 755

‎salt/metalk8s/volumes/prepared/init.sls ‎salt/metalk8s/volumes/prepared.sls

-20
Original file line numberDiff line numberDiff line change
@@ -22,26 +22,6 @@ Volume {{ target_volume_name }} not found in pillar:
2222
{%- do volumes_to_create.extend(all_volumes.values()|list) %}
2323
{%- endif %}
2424

25-
Create the sparse file directory:
26-
file.directory:
27-
- name: /var/lib/metalk8s/storage/sparse/
28-
- makedirs: True
29-
30-
Set up systemd template unit for sparse loop device provisioning:
31-
file.managed:
32-
- name: /etc/systemd/system/metalk8s-sparse-volume@.service
33-
- source: salt://{{ slspath }}/files/metalk8s-sparse-volume@.service
34-
- user: root
35-
- group : root
36-
- mode: 644
37-
38-
Install clean-up script:
39-
file.managed:
40-
- name: /usr/local/libexec/metalk8s-sparse-volume-cleanup
41-
- source: salt://{{ slspath }}/files/sparse_volume_cleanup.py
42-
- user: root
43-
- group : root
44-
- mode: 755
4525

4626
{%- for volume in volumes_to_create %}
4727
{%- set volume_name = volume.metadata.name %}
File renamed without changes.

‎tox.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ commands =
112112
packages/debian/download_packages.py \
113113
); \
114114
untyped_files=( \
115-
salt/metalk8s/volumes/prepared/files/sparse_volume_cleanup.py \
115+
salt/metalk8s/volumes/files/sparse_volume_cleanup.py \
116116
); \
117117
pylint $\{untyped_files[@]\} $\{typed_files[@]\}; PYLINT_RC=$?; \
118118
mypy --strict $\{typed_files[@]\}; MYPY_RC=$?; \

0 commit comments

Comments
 (0)
Please sign in to comment.