Allow to update tftpd configuration
This patch reworks tftpd-hpa module to allow specify tftpd
configuration options like:
username, directory, options
Change-Id: I4fbaa9a4149ca230008099aa29834a8f9de6449b
diff --git a/tftpd_hpa/files/tftpd-hpa.conf b/tftpd_hpa/files/tftpd-hpa.conf
new file mode 100644
index 0000000..089f15e
--- /dev/null
+++ b/tftpd_hpa/files/tftpd-hpa.conf
@@ -0,0 +1,15 @@
+{%- from "tftpd_hpa/map.jinja" import server with context %}
+{%- set opts = [] %}
+{%- for data in server.get('options', []) %}
+{%- if data is mapping %}
+{%- for opt, val in data.iteritems() %}
+{%- do opts.append('--' + opt + ' ' + val) %}
+{%- endfor %}
+{%- else %}
+{%- do opts.append("--" + data) %}
+{%- endif %}
+{%- endfor -%}
+TFTP_USERNAME="{{ server.username }}"
+TFTP_DIRECTORY="{{ server.path }}"
+TFTP_ADDRESS="{{ server.bind.address }}:{{ server.bind.port }}"
+TFTP_OPTIONS="{{ ' '.join(opts) }}"