Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Directory and leaf node #7

Open
qguang opened this issue Sep 21, 2021 · 2 comments
Open

Directory and leaf node #7

qguang opened this issue Sep 21, 2021 · 2 comments
Labels
question Further information is requested

Comments

@qguang
Copy link

qguang commented Sep 21, 2021

Thanks for this utility.

There is a small issue which I guess the use case itself is not really correct.

The current code doesn't handle the scenario below well. if one uses "directory" to store value. it will cause issue.
/test-path/rds/database
/test-path/rds/database/size
/test-path/rds/database/filePath

@christippett
Copy link
Owner

Hi @qguang, thanks for raising this. Can you provide some more detail about the issue you're having - it'd be handy to compare what you have in SSM and what you expect to have returned by the library. Thanks 😊

@christippett christippett added the question Further information is requested label Sep 30, 2021
@qguang
Copy link
Author

qguang commented Oct 3, 2021

Hi @christippett

I pasted code snippet which can be used to reproduce the "issue". Again, I don't think it is a genuine problem. However, it might require some improvement to handle the exception.

`
from pprint import pprint
import boto3
from ssm_parameter_store import EC2ParameterStore

ssm_client = boto3.client("ssm")

ssm_sample = dict(
[
('/test-root-dir/database/movie_db','movie_db_internal'),
('/test-root-dir/database/movie_db/user1','app_user'),
('/test-root-dir/database/movie_db/password','we keep pwd in secret manager'),
]
)

for key, value in ssm_sample.items():
new_parameter = ssm_client.put_parameter(
Name = key,
Value = value,
Description = 'Test SSM', Type = 'String', Overwrite=True,Tier='Standard',DataType='text'
)

store = EC2ParameterStore()

parameters = store.get_parameters_with_hierarchy('/test-root-dir/database/', strip_path=True)

parameters = store.get_parameters_with_hierarchy('/test-root-dir/database/', strip_path=True)
Traceback (most recent call last):
File "", line 1, in
File "../lib/python3.8/site-packages/ssm_parameter_store/stores.py", line 87, in get_parameters_with_hierarchy
leafdict[key_segments[-1]] = value
TypeError: 'str' object does not support item assignment

ssm_keys = list(ssm_sample.keys())
response = ssm_client.delete_parameters(
Names = ssm_keys
)
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants