Formula improvements

     * Add poss. to disable|enable one mirror
     * Add retry for module. Usefull, at unstable networking.

Change-Id: I9a03e3f17be2331ed16b3babda6f671fb94f6003
Closes-Bug: PROD-21610 (PROD:21610)
diff --git a/README.rst b/README.rst
index f53682f..4c1b825 100644
--- a/README.rst
+++ b/README.rst
@@ -5,6 +5,7 @@
 This file provides the debmirror sample pillars configurations for different
 use cases.
 
+See debmirror/schemas/*.yaml for all possible options
 A sample of one debmirror mirror configuration (Ubuntu):
 
 .. code-block:: yaml
@@ -15,6 +16,8 @@
           enabled: true
           mirrors:
             target01:
+              enabled: true
+              fetch_retry: 3
               http_proxy : "url"
               https_proxy: "url"
               ftp_proxy: "url"
diff --git a/debmirror/client/init.sls b/debmirror/client/init.sls
index fc56794..7e7e5f0 100644
--- a/debmirror/client/init.sls
+++ b/debmirror/client/init.sls
@@ -7,11 +7,20 @@
 
 {%- for mirror_name, opts in client.get("mirrors",{}).iteritems() %}
 
+{%- if opts.get('enabled', True ) %}
 debmirror_{{ mirror_name }}_present:
   debmirror.mirror_present:
     - name: {{ mirror_name }}
     - require:
       - debmirror_client_packages
+  {%- if grains['saltversioninfo'][0] >= 2017 and grains['saltversioninfo'][1] >= 7 %}
+    - retry:
+        attempts: {{ opts.get('fetch_retry' , 1) }}
+        until: True
+        interval: 5
+        splay: 2
+  {%- endif %}
+{% endif %}
 
 {%- endfor %}
 {% endif %}
diff --git a/debmirror/schemas/client.yaml b/debmirror/schemas/client.yaml
index 34ad10b..da7debc 100644
--- a/debmirror/schemas/client.yaml
+++ b/debmirror/schemas/client.yaml
@@ -33,6 +33,14 @@
       - mirror_root
       - target_dir
     properties:
+      fetch_retry:
+        description: |-
+          Number of retries, to fetch mirror. Works only with salt 2017+.
+        type: integer
+      enabled:
+        description: |-
+          Enables exact mirror processing.
+        type: boolean
       http_proxy:
         type: string
         description: -|
diff --git a/tests/pillar/client.sls b/tests/pillar/client.sls
index 0c9ec9f..005dd04 100644
--- a/tests/pillar/client.sls
+++ b/tests/pillar/client.sls
@@ -3,6 +3,8 @@
     enabled: true
     mirrors:
       target01:
+        enabled: true
+        fetch_retry: 1
         extra_flags: [ "--verbose", "--progress", "--nosource", "--no-check-gpg", "--rsync-extra=none" ]
         method: "rsync" # string
         arch: [ 'amd64' ]