Exemplo n.º 1
0
def dir_symlink_created(src, dest, symbolic=True, mode=None, owner=None, group=None):
    """
    Ensure that a symlink at `dest` pointing to `src` is created.

    :param src: *required* str; path to the source real directory
    :param dest: *required* str; path to the destination symlink
    """
    cuisine.file_link(src, dest, symbolic=symbolic, mode=mode, owner=owner, group=group)
    cuisine.file_is_link(src)
Exemplo n.º 2
0
    def _condition_common_rules(self):

        time.sleep(1)
        file_path = "/mnt/etc/udev/rules.d/70-persistent-net.rules"
        if file_exists(file_path):
            if not file_is_link(file_path):
                do_sudo(['rm', '-rf', file_path])
                do_sudo(['ln', '-s', '/dev/null', file_path])
Exemplo n.º 3
0
 cuisine.rsync("/etc/csync2/", "/etc/csync2/")
 if not os.path.isdir("/root/.unison"):
     os.mkdir("/root/.unison")
 sed_cmd3 = 'sed "s/SLAVESERVER/'+slaveip+'/g" '+installation_path+'/conf/default.prf > /root/.unison/default.prf'
 subprocess.call(sed_cmd3, shell=True)
 rsync_cmd1 = 'rsync -av '+installation_path+'/conf/lsyncd_master.conf /etc/lsyncd.conf'
 subprocess.call(rsync_cmd1, shell=True)
 sed_cmd4 = 'sed -e "s/MASTERSERVER/'+masteripalone+'/g" -e "s/MASTERSSHPORT/'+masterport+'/g" '+installation_path+'/conf/lsyncd_slave.conf > /tmp/nDeploy_lsyncd.conf'
 subprocess.call(sed_cmd4, shell=True)
 cuisine.rsync("/tmp/nDeploy_lsyncd.conf", "/etc/lsyncd.conf")
 os.remove("/tmp/nDeploy_lsyncd.conf")
 cuisine.run('sed -i "s/^UMASK/#UMASK/" /etc/login.defs')
 if not os.path.isdir("/etc/nginx/"+slaveserver):
     os.mkdir("/etc/nginx/"+slaveserver)
 cuisine.dir_ensure("/etc/nginx/"+slaveserver)
 if not cuisine.file_is_link("/etc/nginx/sites-enabled"):
     cuisine.dir_remove("/etc/nginx/sites-enabled")
     cuisine.file_link("/etc/nginx/"+slaveserver, "/etc/nginx/sites-enabled", symbolic=True)
 subprocess.call('systemctl enable  csync2.socket', shell=True)
 subprocess.call('systemctl start csync2.socket', shell=True)
 cuisine.run('systemctl enable  csync2.socket')
 cuisine.run('systemctl start csync2.socket')
 # Do a Manual csync2 sync
 subprocess.call("/usr/sbin/csync2 -xv", shell=True)
 subprocess.call('grep "/usr/sbin/csync2" /etc/crontab || echo "* * * * * root /usr/sbin/csync2 -x" >> /etc/crontab', shell=True)
 subprocess.call('systemctl restart crond.service', shell=True)
 subprocess.call('systemctl enable  lsyncd.service', shell=True)
 subprocess.call('systemctl start lsyncd.service', shell=True)
 cuisine.run('systemctl enable  lsyncd.service')
 cuisine.run('systemctl start lsyncd.service')
 cuisine.run('systemctl enable nginx.service')
Exemplo n.º 4
0
 def remove_symlink(self):
     (basedir, symlink_location) = self.www_dir.rsplit('/', 1)
     with settings(warn_only=True):
         if file_is_link(self.www_dir):
             with mode_sudo():
                 dir_remove(self.www_dir, recursive = True)
Exemplo n.º 5
0
 cuisine.rsync("/etc/csync2/", "/etc/csync2/")
 if not os.path.isdir("/root/.unison"):
     os.mkdir("/root/.unison")
 sed_cmd3 = 'sed "s/SLAVESERVER/' + slaveip + '/g" ' + installation_path + '/conf/default.prf > /root/.unison/default.prf'
 subprocess.call(sed_cmd3, shell=True)
 rsync_cmd1 = 'rsync -av ' + installation_path + '/conf/lsyncd_master.conf /etc/lsyncd.conf'
 subprocess.call(rsync_cmd1, shell=True)
 sed_cmd4 = 'sed -e "s/MASTERSERVER/' + masteripalone + '/g" -e "s/MASTERSSHPORT/' + masterport + '/g" ' + installation_path + '/conf/lsyncd_slave.conf > /tmp/nDeploy_lsyncd.conf'
 subprocess.call(sed_cmd4, shell=True)
 cuisine.rsync("/tmp/nDeploy_lsyncd.conf", "/etc/lsyncd.conf")
 os.remove("/tmp/nDeploy_lsyncd.conf")
 cuisine.run('sed -i "s/^UMASK/#UMASK/" /etc/login.defs')
 if not os.path.isdir("/etc/nginx/" + slaveserver):
     os.mkdir("/etc/nginx/" + slaveserver)
 cuisine.dir_ensure("/etc/nginx/" + slaveserver)
 if not cuisine.file_is_link("/etc/nginx/sites-enabled"):
     cuisine.dir_remove("/etc/nginx/sites-enabled")
     cuisine.file_link("/etc/nginx/" + slaveserver,
                       "/etc/nginx/sites-enabled",
                       symbolic=True)
 subprocess.call('systemctl enable  csync2.socket', shell=True)
 subprocess.call('systemctl start csync2.socket', shell=True)
 cuisine.run('systemctl enable  csync2.socket')
 cuisine.run('systemctl start csync2.socket')
 # Do a Manual csync2 sync
 subprocess.call("/usr/sbin/csync2 -xv", shell=True)
 subprocess.call(
     'grep "/usr/sbin/csync2" /etc/crontab || echo "* * * * * root /usr/sbin/csync2 -x" >> /etc/crontab',
     shell=True)
 subprocess.call('systemctl restart crond.service', shell=True)
 subprocess.call('systemctl enable  lsyncd.service', shell=True)