Skip to content

Commit

Permalink
Fix to terraform helper and add changes list to more pythonic way (#193)
Browse files Browse the repository at this point in the history
* Item: #58 Desc: Change template to match query parameter from ansible inventory creation

* Item: #58 Desc: Changed list creation to more pythonic way

* Item: #58 Desc: Fix issue with terraform file helper
  • Loading branch information
erzetpe authored Mar 29, 2019
1 parent 811cadf commit 8f20f9f
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions core/src/epicli/cli/engine/AnsibleInventoryCreator.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def create(self):
save_inventory(inventory, self.cluster_model.specification.name)

def get_inventory(self):
inventory = list()
inventory = []
for component_key, component_value in self.cluster_model.specification.components.items():
if component_value.count < 1:
continue
Expand Down Expand Up @@ -56,7 +56,7 @@ def group_duplicated(inventory):
if host not in groups[item.role]:
groups[item.role].append(host)

result = list()
result = []
for key, value in groups.items():
result.append(AnsibleInventoryItem(key, value))
return result
2 changes: 1 addition & 1 deletion core/src/epicli/cli/engine/aws/AWSAPIProxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def get_ips_for_feature(self, feature_key, look_for_public_ip=False):
}]
)

result = list()
result = []
for instance in running_instances:
if look_for_public_ip:
result.append(AnsibleHostModel(instance.public_dns_name, instance.public_ip_address))
Expand Down
2 changes: 1 addition & 1 deletion core/src/epicli/cli/engine/aws/AWSConfigBuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class AWSConfigBuilder(InfrastructureConfigBuilder):
def build(self, cluster_model, user_input):
result = list()
result = []
vpc_config = self.get_vpc_config(cluster_model, user_input)
result.append(vpc_config)
vpc_name = vpc_config.specification.name
Expand Down
2 changes: 1 addition & 1 deletion core/src/epicli/cli/helpers/doc_list_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def select_first(documents, query):

def select_all(documents, query):
if documents is not None:
result = list()
result = []
for x in documents:
if query(x):
result.append(x)
Expand Down
6 changes: 3 additions & 3 deletions core/src/epicli/cli/helpers/terraform_file_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ def generate_terraform_file(infrastructure, template_generator, template_generat
template_generator_config.
templates_paths)

if yaml_document.kind != "epiphany-cluster":
terraform_file_name = "{:03d}".format(idx + 1) + "_" + yaml_document.specification.name + ".tf"
if yaml_document["kind"] != "epiphany-cluster":
terraform_file_name = "{:03d}".format(idx + 1) + "_" + yaml_document["specification"]["name"] + ".tf"
else:
terraform_file_name = "000_" + yaml_document.name + ".tf"
terraform_file_name = "000_" + yaml_document["specification"]["name"] + ".tf"

terraform_output_file_path = os.path.join(terraform_build_directory, terraform_file_name)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ resource "aws_autoscaling_group" "{{ specification.name }}" {
tag {
{%- for tag_key, tag_value in tag.items() %}
key = "{{ tag_key }}"
value = "{% if tag_value is defined and tag_value|length %}{{ tag_value }}{% else %}-{% endif %}"
value = "{{ tag_value }}"
{%- endfor %}
propagate_at_launch = "true"
}
Expand Down

0 comments on commit 8f20f9f

Please sign in to comment.