예제 #1
0
 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 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
예제 #3
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()
예제 #4
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()
     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