Skip to content

Commit

Permalink
Add the ability to read --project-list file from local path
Browse files Browse the repository at this point in the history
The import-goal --project-list option currently only supports
URLs but the requests library doesn't support the file:// protocol:

  psf/requests#2732

This change adds the ability to read a file path for --project-list
instead of rely on URL in case you have a locally modified projects.yaml.

Change-Id: I584534fb32f42e5d78941637285623ad96cf79c3
Story: 2003653
Task: 26066
  • Loading branch information
mriedem committed Sep 4, 2018
1 parent 6e38466 commit fd54f1d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion goal_tools/import_goal.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ def _get_worklist_settings(tag):


def _get_project_info(url):
# First check to see if it's a local path we can read.
if os.path.isfile(url):
with open(url) as f:
return yaml.safe_load(f)
response = requests.get(url)
data = yaml.safe_load(response.text)
return data
Expand Down Expand Up @@ -99,7 +103,8 @@ def main():
parser.add_argument(
'--project-list',
default='http://git.openstack.org/cgit/openstack/governance/plain/reference/projects.yaml', # noqa
help='URL for governance projects list (%(default)s)',
help='URL or file path for governance projects.yaml list '
'(%(default)s)',
)
group = parser.add_mutually_exclusive_group()
group.add_argument(
Expand Down

0 comments on commit fd54f1d

Please sign in to comment.