Commits

Benoit C committed af35473

new branch "abstraction"

  • Participants
  • Parent commits 4d92cbe
  • Branches abstraction

Comments (0)

Files changed (1)

File src/fabfile.py

 import yaml
 import time
 
+def uname():
+    run("uname -a")
+
+def pwd():
+    run("pwd")
+    run("id")
 
 def load_yaml(env_type, conf):
     # sure we can do more there
                             (conf.get('path'), conf.get('workers'),
                              port, pidfile, conf.get('logfile')))
 
-@Permissions("sudo_user", env)
+@Permissions("normal_user", env)
 @ConfChecker("httpd", env)
 def install_httpd_vhost():
     """Install the vhost for your favorite httpd"""
     with cd(proj.get('doc_root')):
         conf = env.yaml.get("httpd")
         fname = "%s/deploy/vhost-%s-%s" % (proj.get('doc_root'), env.type, env.project_name)
-        run("mkdir -p %s/logs/" % env.path)
+#        if not exists(env.path + "/logs"):
+#            run("mkdir -p %s/logs/" % env.path)
         sed(fname, "DOCUMENT_ROOT", "%s" % env.path)
-        sudo("cp %s %s/%s" % (fname, conf.get("av"), env.project_name))
-        sudo("ln -sFf %s/%s %s" % (conf.get("av"), env.project_name, conf.get("en")))
+        sed(fname, "PROJECT_NAME", "%s" % proj.get('name'))
+        copy_vhost()
+
+@Permissions("sudo_user", env)
+@ConfChecker("httpd", env)
+def copy_vhost():
+    proj = env.yaml.get('project')
+    conf = env.yaml.get("httpd")
+    fname = "%s/deploy/vhost-%s-%s" % (proj.get('doc_root'), env.type, env.project_name)
+    sudo("cp %s %s/%s" % (fname, conf.get("av"), env.project_name))
+    sudo("ln -sFf %s/%s %s" % (conf.get("av"), env.project_name, conf.get("en")))
 
 
 @Permissions("normal_user", env)
     services_reload()
     services_restart()
 
+@Permissions("sudo_user", env)
+def nginx_logs():
+    sudo("sudo tail -f /var/log/nginx/*.log")
 
 def reset():
     delete_repos()