revert "daisy version --type internal" function
This reverts "daisy version --type internal" function whilst introducing "daisy version --type pbr" command to retrieve the pbr version instead. Change-Id: I33381633356b8ee45dcda60c7a1b0e5edb9db506 Signed-off-by: Zhijiang Hu <hu.zhijiang@zte.com.cn>
This commit is contained in:
@@ -232,10 +232,22 @@ class Controller(controller.BaseController):
|
||||
:raises HTTPBadRequest if can't get version of daisy
|
||||
"""
|
||||
if version.get('type') == 'internal':
|
||||
scripts = "rpm -q python-daisy | awk -F'-' '{print $3\"-\"$4}'"
|
||||
elif version.get('type') == 'pbr':
|
||||
return {"daisy_version": version_info.version_string_with_vcs()}
|
||||
else:
|
||||
# reserved for external version
|
||||
return {"daisy_version": '1.0.0-1.1.0'}
|
||||
try:
|
||||
version = subprocess.check_output(scripts, shell=True,
|
||||
stderr=subprocess.STDOUT).strip()
|
||||
except:
|
||||
msg = 'Error occurred when running scripts to get version of daisy'
|
||||
LOG.error(msg)
|
||||
raise HTTPForbidden(explanation=msg, request=req,
|
||||
content_type="text/plain")
|
||||
daisy_version = filter(lambda x: not x.isalpha(), version)[:-1]
|
||||
return {"daisy_version": daisy_version}
|
||||
|
||||
|
||||
class BackupRestoreDeserializer(wsgi.JSONRequestDeserializer):
|
||||
|
||||
@@ -2351,8 +2351,9 @@ def do_backup_file_version(dc, args):
|
||||
|
||||
|
||||
@utils.arg('--type', metavar='<TYPE>',
|
||||
help='Type of daisy version, supported type are "internal": '
|
||||
'the internal version of daisy.')
|
||||
help='Type of daisy version, supported types are '
|
||||
'"internal": the internal version of daisy,'
|
||||
'"pbr": the git version of daisy.')
|
||||
def do_version(dc, args):
|
||||
"""Get version of daisy."""
|
||||
fields = dict(filter(lambda x: x[1] is not None, vars(args).items()))
|
||||
|
||||
Reference in New Issue
Block a user