File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -46,7 +46,8 @@ def get_discovery_url_from_user_data():
4646 try :
4747 current_dir = os .path .dirname (__file__ )
4848 user_data_file = file (os .path .abspath (os .path .join (current_dir , name )), 'r' )
49- return re .search ('--discovery (http\S+)' , user_data_file .read ()).group (1 )
49+ user_data_yaml = yaml .safe_load (user_data_file )
50+ return user_data_yaml ['coreos' ]['etcd2' ]['discovery' ]
5051 except :
5152 raise IOError ('Could not load discovery url from ' + name )
5253
Original file line number Diff line number Diff line change @@ -67,14 +67,16 @@ def main():
6767 linode_template = get_file ("linode-user-data-template.yaml" )
6868 coreos_template = get_file ("../coreos/user-data.example" )
6969
70+ coreos_template_string = coreos_template .read ()
71+ coreos_template_string = coreos_template_string .replace ('#DISCOVERY_URL' , 'https://discovery.etcd.io/' + str (etcd_token ))
72+
7073 configuration_linode_template = yaml .safe_load (linode_template )
71- configuration_coreos_template = yaml .safe_load (coreos_template )
74+ configuration_coreos_template = yaml .safe_load (coreos_template_string )
7275
7376 configuration = combine_dicts (configuration_coreos_template , configuration_linode_template )
7477 configuration ['ssh_authorized_keys' ] = public_keys
7578
7679 dump = yaml .dump (configuration , default_flow_style = False , default_style = '|' )
77- dump = dump .replace ('#DISCOVERY_URL' , 'https://discovery.etcd.io/' + str (etcd_token ))
7880
7981 with linode_user_data as outfile :
8082 outfile .write ("#cloud-config\n \n " + dump )
You can’t perform that action at this time.
0 commit comments