Skip to content
This repository was archived by the owner on Jan 1, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ Please update `ansible-galaxy install` command in
README.md to use the newest tag with new release
-->

### Fixed

- Remove old app configurations before uploading a new one

## [1.12.0] - 2022-03-03

### Added
Expand Down
2 changes: 1 addition & 1 deletion library/cartridge_apply_app_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

argument_spec = {
'local_config_path': {'required': True, 'type': 'str'},
'remote_dir': {'required': False, 'type': 'str', 'default': '/tmp/'},
'remote_dir': {'required': False, 'type': 'str', 'default': '/tmp/tarantool.cartridge.configs/'},
'upload_mode': {'required': False, 'type': 'str'},
'console_sock': {'required': False, 'type': 'str'},
'upload_url': {'required': False, 'type': 'str'},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
23 changes: 21 additions & 2 deletions molecule/config_upload_tdg/converge.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---

# We have configs in subfolders with the same names "config" to check the replacement of temporary folders

- name: 'Test file config'
hosts: cluster
become: true
Expand Down Expand Up @@ -34,7 +36,7 @@
import_role:
name: ansible-cartridge
vars:
cartridge_app_config_path: './configs/config-yml'
cartridge_app_config_path: './configs/config-yml/config'
expected_test_section: {config-dir-key: yml}

# Folder config
Expand All @@ -43,13 +45,30 @@
import_role:
name: ansible-cartridge
vars:
cartridge_app_config_path: './configs/config-yml-avsc'
cartridge_app_config_path: './configs/config-yml-avsc/config'
expected_test_section: {config-dir-key: yml-avsc}

###############
# ERROR CASES #
###############

# Folder config with "model.avsc" to test incorrect folder configs with the same names

- name: 'Upload folder config with "model.avsc" only'
ignore_errors: true
import_role:
name: ansible-cartridge
vars:
cartridge_app_config_path: './configs/config-avsc/config'
- name: 'Check upload config failed'
assert:
fail_msg: 'Upload config without config.yml should fail, but config.yml was not removed from previous upload'
success_msg: 'Upload config without config.yml to TDG failed'
that:
- apply_app_config_res.failed
- "'No such file or directory' in apply_app_config_res.msg"
run_once: true

# YAML file config

- name: 'Upload YAML config'
Expand Down
9 changes: 7 additions & 2 deletions tasks/steps/upload_app_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,21 @@
when: cartridge_app_config_path is not none
tags: cartridge-config
block:
- name: 'Remove previously configs'
ansible.builtin.file:
path: '/tmp/tarantool.cartridge.configs/'
state: absent

- name: 'Copy application config on remote host'
any_errors_fatal: true
copy:
src: '{{ cartridge_app_config_path }}'
dest: '/tmp/'
dest: '/tmp/tarantool.cartridge.configs/'

- name: 'Apply application config'
cartridge_apply_app_config:
local_config_path: '{{ cartridge_app_config_path }}'
remote_dir: '/tmp/'
remote_dir: '/tmp/tarantool.cartridge.configs/'
upload_mode: '{{ cartridge_app_config_upload_mode }}'
console_sock: '{{ control_instance.console_sock }}'
upload_url: '{{
Expand Down