Elixir beginner here! I am attempting to generate a bash script based on a config file. When I iterate the configuration and print the string I generate it is all fine. However, when I try to concat or append to a list then I'm not getting anything back!
def generate_post_destroy_content(node_config) do
hosts = create_post_destroy_string(:vmname, node_config)
ips = create_post_destroy_string(:ip, node_config)
content = "#!/bin/bash\n\n#{hosts}\n\n#{ips}"
IO.puts content
end
def create_post_destroy_string(key, node_config) do
# content = ""
content = []
for address <- node_config, do:
# content = content <> "ssh-keygen -f ~/.ssh/known_hosts -R #{address[key]}"]
content = content ++ ["ssh-keygen -f ~/.ssh/known_hosts -R # {address[key]}"]
# IO.puts ["ssh-keygen -f ~/.ssh/known_hosts -R #{address[key]}"]
content = Enum.join(content, "\n")
content
end
my output
#!/bin/bash
=========END=========