Adding filesystem_store_metadata.json template and handler

Change-Id: I3d952013b1443a844f744246af33fd222791064a
diff --git a/glance/files/filesystem_store_metadata.json_template b/glance/files/filesystem_store_metadata.json_template
new file mode 100644
index 0000000..c6b85c1
--- /dev/null
+++ b/glance/files/filesystem_store_metadata.json_template
@@ -0,0 +1,8 @@
+{%- from "glance/map.jinja" import server with context -%}
+{%- if server.filesystem_store_metadata is defined -%}
+{
+{%- for item_key, item_value in server.get('filesystem_store_metadata', {}).iteritems() %}
+  "{{ item_key }}": "{{ item_value }}"
+{%- endfor %}
+}
+{%- endif -%}
\ No newline at end of file
diff --git a/glance/server.sls b/glance/server.sls
index 63d0cbb..539eda0 100644
--- a/glance/server.sls
+++ b/glance/server.sls
@@ -217,6 +217,21 @@
 
 {%- endfor %}
 
+{%- if server.filesystem_store_metadata_file is defined %}
+glance_filesystem_store_metadata_file:
+  file.managed:
+  - name: {{ server.get('filesystem_store_metadata_file', '/etc/glance/filesystem_store_metadata.json') }}
+  - mode: 644
+  - user: glance
+  - group: glance
+  - source: salt://glance/files/filesystem_store_metadata.json_template
+  - template: jinja
+  - require:
+    - pkg: glance_packages
+  - watch_in:
+    - service: glance_services
+{%- endif %}
+
 {%- for name, rule in server.get('policy', {}).iteritems() %}
 
 {%- if rule != None %}