You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Due to issues with current versions of Python and docker-compose needing PyYaml 5.4.1, I want to try and migrate to using python-on-whales to get away from the legacy docker-compose. One stanza of code that's causing me problems is the following which is being used to validate if the compose value is valid:
command= [
'/usr/local/bin/docker', 'compose',
'--file',
compose_file_path,
'config',
'--quiet'
]
# provide environment variables used by the compose file to avoid warningsenvironment= {
'DEFAULT_IAM_ROLE': '',
'ENV': '',
'Name': '',
'VPC': '',
}
returnsubprocess.call(command, env=environment)
If the return code is non-zero then the config is considered invalid.
It's returning a JSON representation of the file which I assume I should take as it being good? I purposely gave it a bad file which resulted in an exception.
I guess my question is:
Is my assumption that it returning JSON means the file is good?
Should I assume any exception is an indication it's bad?
Should I care about the original environment variables in the original stanza?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Due to issues with current versions of Python and docker-compose needing PyYaml 5.4.1, I want to try and migrate to using python-on-whales to get away from the legacy docker-compose. One stanza of code that's causing me problems is the following which is being used to validate if the compose value is valid:
If the return code is non-zero then the config is considered invalid.
I attempted to replicate it with the following:
It's returning a JSON representation of the file which I assume I should take as it being good? I purposely gave it a bad file which resulted in an exception.
I guess my question is:
Beta Was this translation helpful? Give feedback.
All reactions