Skip to content

Commit ab6ce9a

Browse files
author
Glenn Snyder
committed
fixing issue with setting version name and adding some additional help to clarify what are valid values for phase, distribution
1 parent 7d882c7 commit ab6ce9a

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

blackduck/HubRestApi.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,9 @@ class HubInstance(object):
8181
'''
8282
classdocs
8383
'''
84+
VERSION_DISTRIBUTION=["EXTERNAL", "SAAS", "INTERNAL", "OPENSOURCE"]
8485
VERSION_PHASES = ["PLANNING", "DEVELOPMENT", "PRERELEASE", "RELEASED", "DEPRECATED", "ARCHIVED"]
85-
PROJECT_VERSION_SETTINGS = ['nickname', 'releaseComments', 'version', 'phase', 'distribution', 'releasedOn']
86+
PROJECT_VERSION_SETTINGS = ['nickname', 'releaseComments', 'versionName', 'phase', 'distribution', 'releasedOn']
8687

8788
# TODO: What to do about the config file for thread-safety, concurrency
8889
configfile = ".restconfig.json"

examples/update_project_version_settings.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class InvalidSetting(Exception):
1515
pass
1616

1717
def validate_setting(setting):
18-
setting_choices = ["nickname", "notes", "version", "phase", "distribution", "releasedOn"]
18+
setting_choices = HubInstance.PROJECT_VERSION_SETTINGS
1919

2020
if setting not in setting_choices:
2121
raise InvalidSetting("Setting {} is not in the list of valid Settings ({})".format(
@@ -40,7 +40,8 @@ def create_setting_d_from_setting_l(settings_l):
4040
parser = argparse.ArgumentParser("Update one or more settings on a project version in Black Duck")
4141
parser.add_argument("project_name")
4242
parser.add_argument("version_name")
43-
parser.add_argument("-s", "--setting", action="append", nargs=2,metavar=('setting', 'value'))
43+
parser.add_argument("-s", "--setting", action="append", nargs=2,metavar=('setting', 'value'),
44+
help=f"Settings you can change are {HubInstance.PROJECT_VERSION_SETTINGS}. Possible phases are {HubInstance.VERSION_PHASES}. Possible distribution values are {HubInstance.VERSION_DISTRIBUTION}")
4445

4546
args = parser.parse_args()
4647

0 commit comments

Comments
 (0)