Skip to content

Commit

Permalink
fix(contrib/linode): fix discovery url issues in deployment scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
croemmich committed Oct 31, 2015
1 parent 2c5d0da commit 0d18d2c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion contrib/linode/apply-firewall.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ def get_discovery_url_from_user_data():
try:
current_dir = os.path.dirname(__file__)
user_data_file = file(os.path.abspath(os.path.join(current_dir, name)), 'r')
return re.search('--discovery (http\S+)', user_data_file.read()).group(1)
user_data_yaml = yaml.safe_load(user_data_file)
return user_data_yaml['coreos']['etcd2']['discovery']
except:
raise IOError('Could not load discovery url from ' + name)

Expand Down
6 changes: 4 additions & 2 deletions contrib/linode/create-linode-user-data.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,16 @@ def main():
linode_template = get_file("linode-user-data-template.yaml")
coreos_template = get_file("../coreos/user-data.example")

coreos_template_string = coreos_template.read()
coreos_template_string = coreos_template_string.replace('#DISCOVERY_URL', 'https://discovery.etcd.io/' + str(etcd_token))

configuration_linode_template = yaml.safe_load(linode_template)
configuration_coreos_template = yaml.safe_load(coreos_template)
configuration_coreos_template = yaml.safe_load(coreos_template_string)

configuration = combine_dicts(configuration_coreos_template, configuration_linode_template)
configuration['ssh_authorized_keys'] = public_keys

dump = yaml.dump(configuration, default_flow_style=False, default_style='|')
dump = dump.replace('#DISCOVERY_URL', 'https://discovery.etcd.io/' + str(etcd_token))

with linode_user_data as outfile:
outfile.write("#cloud-config\n\n" + dump)
Expand Down

0 comments on commit 0d18d2c

Please sign in to comment.