diff --git a/CHANGELOG.md b/CHANGELOG.md index bc72fa1..75694e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +## [2.0.3] - 2021-09-14 + +### Fixed + +- Fix `!file` resolver, the path is not being resolved correctly based on the config directory. [issue-40](https://github.com/lucasvieirasilva/aws-ssm-secrets-cli/issues/40) + ## [2.0.2] - 2021-09-14 ### Fixed diff --git a/aws_secrets/__init__.py b/aws_secrets/__init__.py index 668c344..e7c12d2 100644 --- a/aws_secrets/__init__.py +++ b/aws_secrets/__init__.py @@ -1 +1 @@ -__version__ = '2.0.2' +__version__ = '2.0.3' diff --git a/aws_secrets/tags/file.py b/aws_secrets/tags/file.py index 9141372..2b53fb4 100644 --- a/aws_secrets/tags/file.py +++ b/aws_secrets/tags/file.py @@ -1,6 +1,5 @@ import logging import os -from pathlib import Path import click import yaml @@ -46,10 +45,11 @@ def __repr__(self) -> str: config_file = click_ctx.obj.get('config_file', '') working_dir = os.path.dirname(config_file) - source_file_path = Path(os.path.relpath(self.value, working_dir)).resolve() + source_file_path = os.path.join(working_dir, self.value) - if source_file_path.exists(): - return source_file_path.read_text() + if os.path.exists(source_file_path): + with open(source_file_path, 'r') as source: + return source.read() else: raise CLIError(f"File '{source_file_path}' not found")