Vladimir Mihailenco  committed 8295485

Add upload_init_template

  • Participants
  • Parent commits 4c80278
  • Branches default

Comments (0)

Files changed (2)

File fabdeploy/

 from . import pip
 from .containers import conf
 from .task import Task as BaseTask
-from .utils import upload_config_template
+from .utils import upload_config_template, upload_init_template
 __all__ = [
 class PushInitConfig(Task):
     def do(self):
-        upload_config_template(
-            'init/supervisord.conf', '/etc/init', use_sudo=True)
-        sudo('chown --recursive root:root /etc/init/supervisord.conf')
+        upload_init_template('supervisord.conf', use_sudo=True)
 push_init_config = PushInitConfig()

File fabdeploy/

 from functools import wraps
 from contextlib import contextmanager
-from fabric.api import env, cd, prefix, abort
+from fabric.api import env, sudo, cd, prefix, abort
 from fabric import network
 from fabric.contrib.files import upload_template
         config_template, to, context, use_jinja=True, **kwargs)
+def upload_init_template(name, **kwargs):
+    template = 'init/' + name
+    to = posixpath.join('/etc/init', name)
+    upload_config_template(template, to, use_sudo=True, **kwargs)
+    sudo('chown --recursive root:root ' + to)
 # TODO: move to conf
 def unprefix_conf(conf, namespaces):
     for ns in namespaces: