Changeset - eeec809e0f90
[Not reviewed]
0 5 0
Branko Majic (branko) - 3 years ago 2021-01-13 19:36:18
branko@majic.rs
MAR-151: Added support for Debian 10 Buster to backup_client role:

- Updated tests.
- Refactored one of the test to determine hostname dynamically.
- Update role reference documentation.
5 files changed with 36 insertions and 7 deletions:
0 comments (0 inline, 0 general)
docs/rolereference.rst
Show inline comments
 
@@ -2341,6 +2341,7 @@ Distribution compatibility
 
Role is compatible with the following distributions:
 

	
 
- Debian 9 (Stretch)
 
- Debian 10 (Buster)
 

	
 

	
 
Examples
roles/backup_client/molecule/default/molecule.yml
Show inline comments
 
@@ -18,7 +18,7 @@ lint:
 
# stupid legacy design decisions!
 
platforms:
 
  - name: backup-server
 
    box: debian/contrib-stretch64
 
    box: debian/contrib-buster64
 
    memory: 512
 
    cpus: 1
 
    interfaces:
 
@@ -27,6 +27,30 @@ platforms:
 
        network_name: private_network
 
        type: static
 

	
 
  - name: parameters-mandatory-b64
 
    groups:
 
      - parameters-mandatory
 
    box: debian/contrib-buster64
 
    memory: 256
 
    cpus: 1
 
    interfaces:
 
      - auto_config: true
 
        ip: 10.31.127.20
 
        network_name: private_network
 
        type: static
 

	
 
  - name: parameters-optional-b64
 
    groups:
 
      - parameters-optional
 
    box: debian/contrib-buster64
 
    memory: 256
 
    cpus: 1
 
    interfaces:
 
      - auto_config: true
 
        ip: 10.31.127.21
 
        network_name: private_network
 
        type: static
 

	
 
  - name: parameters-mandatory-s64
 
    groups:
 
      - parameters-mandatory
roles/backup_client/molecule/default/prepare.yml
Show inline comments
 
@@ -86,7 +86,7 @@
 
      with_items:
 
        - /home/backupuser
 
        - /home/bak-parameters-mandatory-s64
 
        - /home/bak-parameters-mandatory-j64
 
        - /home/bak-parameters-mandatory-b64
 

	
 
    - name: Set-up duplicity backup directories
 
      file:
 
@@ -107,7 +107,7 @@
 
        mode: 0700
 
      with_items:
 
        - "parameters-optional-s64"
 
        - "parameters-optional-j64"
 
        - "parameters-optional-b64"
 

	
 
  handlers:
 
    - name: Restart ssh
 
@@ -117,9 +117,9 @@
 

	
 
  vars:
 
    backup_users:
 
      - name: bak-parameters-mandatory-j64
 
        key: "{{ lookup('file', 'tests/data/ssh/parameters-mandatory.pub') }}"
 
      - name: bak-parameters-mandatory-s64
 
        key: "{{ lookup('file', 'tests/data/ssh/parameters-mandatory.pub') }}"
 
      - name: bak-parameters-mandatory-b64
 
        key: "{{ lookup('file', 'tests/data/ssh/parameters-mandatory.pub') }}"
 
      - name: backupuser
 
        key: "{{ lookup('file', 'tests/data/ssh/parameters-optional.pub') }}"
roles/backup_client/molecule/default/tests/test_parameters_mandatory.py
Show inline comments
 
@@ -62,13 +62,15 @@ def test_duply_configuration_content(host):
 
    Tests if duply configuration has been set-up correctly.
 
    """
 

	
 
    hostname = host.run('hostname').stdout.strip()
 

	
 
    with host.sudo():
 

	
 
        duply_configuration = host.file('/etc/duply/main/conf')
 

	
 
        assert "GPG_KEYS_ENC='59C26F031A129C54'" in duply_configuration.content_string
 
        assert "GPG_KEY_SIGN='59C26F031A129C54'" in duply_configuration.content_string
 
        assert "TARGET='pexpect+sftp://bak-parameters-mandatory-s64@10.31.127.10:2222//duplicity'" in duply_configuration.content_string
 
        assert "TARGET='pexpect+sftp://bak-%s@10.31.127.10:2222//duplicity'" % hostname in duply_configuration.content_string
 
        assert "DUPL_PARAMS=\"$DUPL_PARAMS --ssh-options='-oLogLevel=ERROR -oUserKnownHostsFile=/dev/null " \
 
            "-oGlobalKnownHostsFile=/etc/duply/main/ssh/known_hosts -oIdentityFile=/etc/duply/main/ssh/identity'\"" in duply_configuration.content_string
 

	
roles/backup_client/molecule/default/tests/test_parameters_optional.py
Show inline comments
 
@@ -61,13 +61,15 @@ def test_duply_configuration_content(host):
 
    Tests if duply configuration has been set-up correctly.
 
    """
 

	
 
    hostname = host.run('hostname').stdout.strip()
 

	
 
    with host.sudo():
 

	
 
        duply_configuration = host.file('/etc/duply/main/conf')
 

	
 
        assert "GPG_KEYS_ENC='C4B2AE9F7A4F400A,3093C91BC3A9444B,86816FD928063B3F,8A14CD6C71223B72'" in duply_configuration.content_string
 
        assert "GPG_KEY_SIGN='C4B2AE9F7A4F400A'" in duply_configuration.content_string
 
        assert "TARGET='pexpect+sftp://backupuser@10.31.127.10:3333//duplicity/parameters-optional-s64'" in duply_configuration.content_string
 
        assert "TARGET='pexpect+sftp://backupuser@10.31.127.10:3333//duplicity/%s'" % hostname in duply_configuration.content_string
 
        assert "DUPL_PARAMS=\"$DUPL_PARAMS --ssh-options='-oLogLevel=ERROR -oUserKnownHostsFile=/dev/null " \
 
            "-oGlobalKnownHostsFile=/etc/duply/main/ssh/known_hosts -oIdentityFile=/etc/duply/main/ssh/identity'\"" in duply_configuration.content_string
 

	
0 comments (0 inline, 0 general)