MCPcopy Index your code
hub / github.com/StackStorm/st2 / get_stackstorm_version

Function get_stackstorm_version

st2client/st2client/shell.py:139–168  ·  view source on GitHub ↗

Return StackStorm version including git commit revision if running a dev release and a file with package metadata which includes git revision is available. :rtype: ``str``

()

Source from the content-addressed store, hash-verified

137
138
139def get_stackstorm_version():
140 """
141 Return StackStorm version including git commit revision if running a dev release and a file
142 with package metadata which includes git revision is available.
143
144 :rtype: ``str``
145 """
146 if "dev" in __version__:
147 version = __version__
148
149 if not os.path.isfile(PACKAGE_METADATA_FILE_PATH):
150 return version
151
152 config = ConfigParser()
153
154 try:
155 config.read(PACKAGE_METADATA_FILE_PATH)
156 except Exception:
157 return version
158
159 try:
160 git_revision = config.get("server", "git_sha")
161 except Exception:
162 return version
163
164 version = "%s (%s)" % (version, git_revision)
165 else:
166 version = __version__
167
168 return version
169
170
171class Shell(BaseCLIApp):

Callers 1

__init__Method · 0.70

Calls 2

readMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected