Skip to content

Commit

Permalink
added "--comment" parameter to change the default publish description (
Browse files Browse the repository at this point in the history
  • Loading branch information
camandel authored and ggatward committed Dec 13, 2017
1 parent be91523 commit 35e4975
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions publish_content_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def get_cv(org_id, publish_list):
return ver_list, ver_descr, ver_version


def publish(ver_list, ver_descr, ver_version, dry_run, runuser, quiet):
def publish(ver_list, ver_descr, ver_version, dry_run, runuser, description, quiet):
"""Publish Content View"""

# Set the task name to be displayed in the task monitoring stage
Expand Down Expand Up @@ -88,9 +88,6 @@ def publish(ver_list, ver_descr, ver_version, dry_run, runuser, quiet):
helpers.log_msg(msg, 'INFO')
print helpers.HEADER + msg + helpers.ENDC

# Set up the description that will be added to the published version
description = "Published by " + runuser + "\n via API script"

if not dry_run and not locked:
try:
task_id = helpers.post_json(
Expand Down Expand Up @@ -150,6 +147,7 @@ def main(args):
required=False, action="store_true")
parser.add_argument('-l', '--last', help='Display last promotions', required=False,
action="store_true")
parser.add_argument('-c', '--comment', help="Add a custom description", required=False)
parser.add_argument('-q', '--quiet', help="Suppress progress output updates", required=False,
action="store_true")

Expand All @@ -164,8 +162,14 @@ def main(args):
if args.org:
org_name = args.org
else:
org_name = helpers.ORG_NAME
org_name = helpers.ORG_NAME
dry_run = args.dryrun

# Set up the description that will be added to the published version
if args.comment:
description = args.comment
else:
description = "Published by " + runuser + "\n via API script"

# Load the promotion history
if not os.path.exists(vardir + '/promotions.pkl'):
Expand Down Expand Up @@ -209,7 +213,7 @@ def main(args):
(ver_list, ver_descr, ver_version) = get_cv(org_id, publish_list)

# Publish the content views. Returns a list of task IDs.
publish(ver_list, ver_descr, ver_version, dry_run, runuser, args.quiet)
publish(ver_list, ver_descr, ver_version, dry_run, runuser, description, args.quiet)

# Add/Update the promotion history dictionary so we can check when we last promoted
phistory['Library'] = datetime.datetime.strftime(datetime.datetime.now(), '%Y-%m-%d')
Expand Down

0 comments on commit 35e4975

Please sign in to comment.