Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature/deploy-service-from-url #238

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions fandogh_cli/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import urllib
from string import Template
from urllib.request import urlopen

import click
import os
from datetime import datetime
Expand Down Expand Up @@ -94,12 +97,22 @@ def trim_comments(manifest):

def read_manifest(manifest_file, parameters):
try:
with open(manifest_file, mode='r') as manifest:
rendered_manifest = process_template(
manifest.read(),
parse_key_values(
parameters

if str(manifest_file).startswith('http'):
with urllib.request.urlopen(manifest_file) as manifest:
rendered_manifest = process_template(
manifest.read().decode('utf-8'),
parse_key_values(
parameters
)
)
else:
with open(manifest_file) as manifest:
rendered_manifest = process_template(
manifest.read(),
parse_key_values(
parameters
)
)
return trim_comments(rendered_manifest)
except IOError as e:
Expand Down