add edit-deliverable command
Add a new command for making small changes to deliverable files. The first version knows how to set the release notes URL. Change-Id: I7b4949d2e93bf6bdfd0080f42a0a3c32a9631750 Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
parent
baf36c6230
commit
6080c4b5ae
69
openstack_releases/cmds/edit_deliverable.py
Normal file
69
openstack_releases/cmds/edit_deliverable.py
Normal file
@ -0,0 +1,69 @@
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
|
||||
from openstack_releases import yamlutils
|
||||
|
||||
import yaml
|
||||
|
||||
|
||||
def get_deliverable_data(series, deliverable):
|
||||
deliverable_filename = 'deliverables/%s/%s.yaml' % (
|
||||
series, deliverable)
|
||||
with open(deliverable_filename, 'r') as f:
|
||||
return yaml.safe_load(f)
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument(
|
||||
'series',
|
||||
help='the name of the release series to scan',
|
||||
)
|
||||
parser.add_argument(
|
||||
'deliverable',
|
||||
help='the base name of the deliverable file',
|
||||
)
|
||||
parser.add_argument(
|
||||
'--release-notes',
|
||||
help='the release-notes URL',
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
# Allow for independent projects.
|
||||
series = args.series
|
||||
if series.lstrip('_') == 'independent':
|
||||
series = '_independent'
|
||||
|
||||
# Load existing deliverable data.
|
||||
try:
|
||||
deliverable_info = get_deliverable_data(
|
||||
series, args.deliverable)
|
||||
except (IOError, OSError) as e:
|
||||
parser.error(e)
|
||||
|
||||
changes = 0
|
||||
|
||||
if args.release_notes:
|
||||
deliverable_info['release-notes'] = args.release_notes
|
||||
changes += 1
|
||||
|
||||
if changes > 0:
|
||||
deliverable_filename = 'deliverables/%s/%s.yaml' % (
|
||||
series, args.deliverable)
|
||||
with open(deliverable_filename, 'w', encoding='utf-8') as f:
|
||||
f.write(yamlutils.dumps(deliverable_info))
|
@ -37,6 +37,7 @@ console_scripts =
|
||||
propose-final-releases = openstack_releases.cmds.propose_final_releases:main
|
||||
make-tracking-pad = openstack_releases.cmds.make_tracking_pad:main
|
||||
propose-library-branches = openstack_releases.cmds.propose_library_branches:main
|
||||
edit-deliverable = openstack_releases.cmds.edit_deliverable:main
|
||||
|
||||
[extras]
|
||||
sphinxext =
|
||||
|
Loading…
x
Reference in New Issue
Block a user