-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[sonic-py-common] Added an API to get file path containing SONiC version #6309
Conversation
The new |
It will be used in 'sonic-utilities/config'. sonic-net/sonic-utilities#1266 checkout config/main.py. |
retest mellanox please |
retest vsimage please |
retest mellanox please |
@@ -297,6 +297,11 @@ def get_sonic_version_info(): | |||
|
|||
return data | |||
|
|||
def get_sonic_version_file(): | |||
if not os.path.isfile(SONIC_VERSION_YAML_PATH): | |||
return None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does all the current callers of this API, handle a return value of "None" ? If this is a mandatory file, we could raise an exception.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is only one caller (sonic-net/sonic-utilities#1266). I'd say let's leave it to the caller to decide. Python will raise exception anyway.
retest mellanox please |
…ion (#6309) * [sonic-py-common] add an API to get file path containing SONiC version so that the API can be mocked for unit tests.
- Why I did it
Added an API to get the file path containing SONiC version so that the API can be mocked during unit tests.
- How I did it
Added the API.
- How to verify it
Manual verification.
- Which release branch to backport (provide reason below if selected)
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)