Merge pull request #19 from horakmar/add_timeout
Add timeout parameter into publish script with default value [3600 sec]
diff --git a/aptly/files/aptly_publish_update.sh b/aptly/files/aptly_publish_update.sh
index 4ff2dd3..536e1aa 100644
--- a/aptly/files/aptly_publish_update.sh
+++ b/aptly/files/aptly_publish_update.sh
@@ -12,6 +12,7 @@
RECREATE=0
FORCE_OVERWRITE=0
PUBLISHER_OPTIONS=""
+TIMEOUT=3600
COMMAND=`basename $0`
## Functions ## ============================
@@ -48,6 +49,7 @@
-c ... cleanup unused snapshots
-r ... drop publish and create it again, the only way to add new components
-f ... overwrite files in pool directory without notice
+ -t ... publisher timeout in seconds [3600]
EOF
exit
@@ -73,6 +75,7 @@
r) RECREATE=1 ;;
f) FORCE_OVERWRITE=1 ;;
u) URL=$2; shift ;;
+ t) TIMEOUT=$2; shift ;;
esac
r=$(expr substr $r 2 255)
done
@@ -96,7 +99,7 @@
PUBLISHER_OPTIONS+=" --force-overwrite"
fi
-aptly-publisher --timeout=1200 publish -v -c /etc/aptly/publisher.yaml --url ${URL} --architectures amd64 $PUBLISHER_OPTIONS
+aptly-publisher --timeout=${TIMEOUT} publish -v -c /etc/aptly/publisher.yaml --url ${URL} --architectures amd64 $PUBLISHER_OPTIONS
if [[ $? -ne 0 ]]; then
log_error "Aptly publisher failed."
diff --git a/aptly/publisher.sls b/aptly/publisher.sls
index a286125..16e68bd 100644
--- a/aptly/publisher.sls
+++ b/aptly/publisher.sls
@@ -16,6 +16,9 @@
publisher_installed:
pip.installed:
- name: python-aptly
+ {%- if publisher.source.get('proxy', None) %}
+ - proxy: {{ publisher.source.get('proxy') }}
+ {%- endif %}
- require:
- pkg: publisher_python_pip
diff --git a/aptly/schemas/publisher.yaml b/aptly/schemas/publisher.yaml
index 6f5b55f..17fd776 100644
--- a/aptly/schemas/publisher.yaml
+++ b/aptly/schemas/publisher.yaml
@@ -30,4 +30,7 @@
type: string
registry:
description: Docker regirsty host for publisher image. Set if installation from docker is chosen
- type: string
\ No newline at end of file
+ type: string
+ proxy:
+ description: Proxy for accessing installation source (probably meaningful only for pip source)
+ type: string
diff --git a/aptly/schemas/server.yaml b/aptly/schemas/server.yaml
index 73eb923..5b9f8d6 100644
--- a/aptly/schemas/server.yaml
+++ b/aptly/schemas/server.yaml
@@ -101,6 +101,9 @@
keyring:
description: Keyring for GPG
type: string
+ http_proxy:
+ description: HTTP proxy to use for keys download
+ type: string
api:
description: Parameters map for for APTLY API services
type: object
@@ -228,4 +231,4 @@
_architectures:
description: Packages architecture
type: string
- example: amd64
\ No newline at end of file
+ example: amd64
diff --git a/aptly/server/mirrors.sls b/aptly/server/mirrors.sls
index 4e31e9d..0c409f4 100644
--- a/aptly/server/mirrors.sls
+++ b/aptly/server/mirrors.sls
@@ -40,6 +40,27 @@
{%- for mirror_name, mirror in server.mirror.iteritems() %}
+{%- if mirror.get('key_url', None) %}
+gpg_add_keys_{{ mirror_name }}_fromurl:
+ cmd.run:
+ - name: curl -Ls {{ mirror.get('key_url') }} | gpg --no-tty {% if server.gpg.get('keyring', None) %} --no-default-keyring --keyring {{ server.gpg.keyring }} {% endif %}{% if server.gpg.get('homedir', None) %} --homedir {{ server.gpg.homedir }}{% endif %} --import
+ - runas: {{ server.user.name }}
+ - cwd: {{ server.home_dir }}
+ - unless: gpg --no-tty {% if server.gpg.get('keyring', None) %} --no-default-keyring --keyring {{ server.gpg.keyring }} {% endif %}{% if server.gpg.get('homedir', None) %} --homedir {{ server.gpg.homedir }} {% endif %} --list-public-keys $(curl -Ls {{ mirror.get('key_url') }} | gpg --with-colons | cut -f 5 -d ':')
+ {%- if server.secure %}
+ - require:
+ - cmd: import_gpg_priv_key
+ - cmd: import_gpg_pub_key
+ - require_in:
+ - cmd: aptly_{{ mirror_name }}_mirror
+ {%- endif %}
+ {%- if server.gpg.get('http_proxy', None) %}
+ - env:
+ - http_proxy: {{ server.gpg.get('http_proxy') }}
+ - https_proxy: {{ server.gpg.get('http_proxy') }}
+ {%- endif %}
+{%- endif %}
+
{%- for gpgkey in mirror.get('gpgkeys', []) %}
gpg_add_keys_{{ mirror_name }}_{{ gpgkey }}:
@@ -47,7 +68,7 @@
- name: gpg --no-tty {% if server.gpg.get('keyring', None) %} --no-default-keyring --keyring {{ server.gpg.keyring }} {% endif %}{% if server.gpg.get('homedir', None) %} --homedir {{ server.gpg.homedir }}{% endif %} --keyserver {{ mirror.keyserver|default(server.gpg.keyserver) }} {% if server.gpg.get('http_proxy', None) %} --keyserver-options http-proxy={{ server.gpg.get('http_proxy') }} {% endif %} --recv-keys {{ gpgkey }}
- runas: {{ server.user.name }}
- cwd: {{ server.home_dir }}
- - unless: gpg --no-tty {% if server.gpg.get('keyring', None) %} --no-default-keyring --keyring {{ server.gpg.keyring }} {% endif %}{% if server.gpg.get('homedir', None) %} --homedir {{ server.gpg.homedir }} {% endif %} {% if server.gpg.get('http_proxy', None) %} --keyserver-options http-proxy={{ server.gpg.get('http_proxy') }} {% endif %} --list-public-keys {{gpgkey}}
+ - unless: gpg --no-tty {% if server.gpg.get('keyring', None) %} --no-default-keyring --keyring {{ server.gpg.keyring }} {% endif %}{% if server.gpg.get('homedir', None) %} --homedir {{ server.gpg.homedir }} {% endif %} --list-public-keys {{gpgkey}}
{%- if server.secure %}
- require:
- cmd: import_gpg_priv_key
@@ -93,6 +114,10 @@
{%- if server.source.engine == "docker" %}
- require:
- file: aptly_wrapper
+ {%- elif server.mirror_update.get('http_proxy', None) %}
+ - env:
+ - http_proxy: {{ server.mirror_update.get('http_proxy') }}
+ - https_proxy: {{ server.mirror_update.get('http_proxy') }}
{%- endif %}
aptly_{{ mirror_name }}_mirror_edit: