Merge pull request #9 from stelucz/proxy-option
Proxy option
diff --git a/README.rst b/README.rst
index 6321347..d84ba04 100644
--- a/README.rst
+++ b/README.rst
@@ -100,6 +100,20 @@
distributions:
- nightly/trusty
+Proxy environment variables (optional) in cron job for mirroring script
+
+.. code-block:: yaml
+
+ aptly:
+ server:
+ enabled: true
+ ...
+ mirror_update:
+ enabled: true
+ http_proxy: "http://1.2.3.4:8000"
+ https_proxy: "http://1.2.3.4:8000"
+ ...
+
Read more
=========
diff --git a/aptly/server/mirrors.sls b/aptly/server/mirrors.sls
index cd19a10..5bdb17b 100644
--- a/aptly/server/mirrors.sls
+++ b/aptly/server/mirrors.sls
@@ -4,7 +4,7 @@
aptly_mirror_update_cron:
cron.present:
- - name: "/usr/local/bin/aptly_mirror_update.sh -s"
+ - name: "{% if server.mirror_update.http_proxy is defined %}export http_proxy={{ server.mirror_update.http_proxy }}; {% endif %}{% if server.mirror_update.https_proxy is defined %}export https_proxy={{ server.mirror_update.https_proxy }}; {% endif %}/usr/local/bin/aptly_mirror_update.sh -s"
- identifier: aptly_mirror_update
- hour: "{{ server.mirror_update.hour }}"
- minute: "{{ server.mirror_update.minute }}"
diff --git a/tests/pillar/default.sls b/tests/pillar/default.sls
index 8f85ef1..35431e3 100644
--- a/tests/pillar/default.sls
+++ b/tests/pillar/default.sls
@@ -16,6 +16,8 @@
enabled: true
hour: 2
minute: random
+ http_proxy: "http://1.2.3.4:8000"
+ https_proxy: "https://1.2.3.4:8000"
gpg_passphrase: passphrase
gpg_private_key: |
-----BEGIN PGP PRIVATE KEY BLOCK-----