20
20
from typing import List
21
21
import coloredlogs
22
22
23
- from dynaconf import settings
24
23
from .installer import install_cluster , delete_cluster , storage , download_installer
24
+ from .config import read_config
25
25
26
26
27
27
def _identity (in_attr : str ) -> str :
@@ -36,6 +36,7 @@ def _read_list(in_str: str) -> List[str]:
36
36
'common' : {
37
37
'cloud' : {'help' : 'Cloud provider to be used.' , 'type' : str ,
38
38
'choices' : ['openstack' , 'aws' ]},
39
+ 'cloud_environment' : {'help' : 'Environment of cloud to be used.' , 'type' : str },
39
40
'dns_provider' : {'help' : 'Provider of dns used with openstack cloud' ,
40
41
'type' : str , 'choices' : ['nsupdate' , 'route53' ]}
41
42
},
@@ -92,36 +93,10 @@ def _resolve_installer(from_args):
92
93
93
94
94
95
def _merge_dictionaries (from_args ):
95
- result = {'cloud' : None ,
96
- 'dns' : None ,
97
- 'installer' : _resolve_installer (from_args ),
98
- 'cloud_name' : None ,
99
- 'cluster_name' : from_args .cluster_name }
100
- if not from_args .__contains__ ('cloud' ):
101
- return result
102
- defaults = settings .as_dict ()
103
- if from_args .dns_provider is not None :
104
- result ['dns' ] = {'provider' : from_args .dns_provider ,
105
- 'conf' : defaults ['DNS' ][from_args .dns_provider ]}
106
- result ['dns' ]['conf' ].update (
107
- {j [4 :]: i ['proc' ](vars (from_args )[j ])
108
- for j , i in ARGUMENTS ['dns' ].items ()
109
- if vars (from_args )[j ] is not None }
110
- )
111
- if from_args .cloud is not None :
112
- result ['cloud_name' ] = from_args .cloud
113
- result ['cloud' ] = defaults ['CLOUD' ][from_args .cloud ]
114
- result ['cloud' ].update (
115
- {j : i ['proc' ](vars (from_args )[j ]) for j , i in ARGUMENTS ['install' ].items ()
116
- if vars (from_args )[j ] is not None }
117
- )
118
- # pylint: disable=unsupported-assignment-operation
119
- result ['cloud' ]['installer' ] = result ['installer' ]
120
- if result ['dns' ] is not None :
121
- result ['dns' ]['conf' ].update ({
122
- 'cluster_name' : from_args .cluster_name ,
123
- 'base_domain' : result ['cloud' ]['base_domain' ]
124
- })
96
+ result = read_config (from_args , ARGUMENTS )
97
+ result ["installer" ] = _resolve_installer (from_args )
98
+ # pylint: disable=unsupported-assignment-operation
99
+ result ['cloud' ]['installer' ] = result ['installer' ]
125
100
return result
126
101
127
102
@@ -130,6 +105,7 @@ def _exec_install_cluster(args):
130
105
if not args .skip_git :
131
106
storage .check_repository ()
132
107
logging .info ('Starting the installer with cloud name %s' , conf ['cloud_name' ])
108
+ print (conf )
133
109
install_cluster (
134
110
conf ['cloud_name' ],
135
111
conf ['cluster_name' ],
0 commit comments