def apply_terraform(self, cluster, mix_vars): if not self.working_path: self.working_path = create_terrafrom_working_dir( cluster_name=cluster.name) generate_terraform_file(self.working_path, self.cloud_config_path, mix_vars) self.init_terraform()
def destroy_terraform(self, cluster): if not self.working_path: self.working_path = create_terrafrom_working_dir(cluster_name=cluster) t = Terraform(working_dir=self.working_path) p, _, _ = t.destroy('./', synchronous=False, no_color=IsNotFlagged, refresh=True) for i in p.stdout: print(i.decode()) _, err = p.communicate() print(err.decode()) return p.returncode == 0
def apply_terraform(self, cluster, hosts_dict): if not self.working_path: self.working_path = create_terrafrom_working_dir(cluster_name=cluster.name) generate_terraform_file(self.working_path, self.cloud_config_path, cluster.plan.mixed_vars, hosts_dict) self.init_terraform() t = Terraform(working_dir=self.working_path) p, _, _ = t.apply('./', refresh=True, skip_plan=True, no_color=IsNotFlagged, synchronous=False) for i in p.stdout: print(i.decode()) _, err = p.communicate() print(err.decode()) return p.returncode == 0
def apply_terraform(self, cluster): vars = cluster.plan.mixed_vars hosts = [] for host in cluster.terraform_hosts.all(): hosts.append(host.to_dict()) vars['hosts'] = hosts if not self.working_path: self.working_path = create_terrafrom_working_dir( cluster_name=cluster.name) generate_terraform_file(self.working_path, self.cloud_config_path, vars) self.init_terraform()
def apply_terraform(self, cluster): vars = cluster.plan.mixed_vars hosts = [] for host in cluster.terraform_hosts.all(): hosts.append(host.to_dict()) vars['hosts'] = hosts if not self.working_path: self.working_path = create_terrafrom_working_dir(cluster_name=cluster.name) generate_terraform_file(self.working_path, self.cloud_config_path, vars) self.init_terraform() t = Terraform(working_dir=self.working_path) p, _, _ = t.apply('./', refresh=True, skip_plan=True, no_color=IsNotFlagged, synchronous=False) for i in p.stdout: print(i.decode()) _, err = p.communicate() print(err.decode()) return p.returncode == 0