cuisine-extras

For the stuff not in cuisine

4 years after

cuisine-extras

For the stuff not in cuisine

Functions

dir_attribs_recursive

Change dir and file attribs recursively with the option of specifying seperate modes for files and dirs.

Example:

tree/
    branch/
        file

Before:
$ ls -lah tree/branch/
drwxrwxr-x 2 gmendiola gmendiola 4.0K Apr 15 10:49 .
drwxrwxr-x 3 gmendiola gmendiola 4.0K Apr 15 10:49 ..
-rw-rw-r-- 1 gmendiola gmendiola    0 Apr 15 10:49 file

dir_attribs_recursive('/tmp/tree', file_mode=644, dir_mode=755, owner='user', group='group')

After:
$ ls -lah tree/branch/
drwxr-xr-x 2 user group 4.0K Apr 15 10:49 .
drwxr-xr-x 3 user group 4.0K Apr 15 10:49 ..
-rw-r--r-- 1 user group 0 Apr 15 10:49 file

apache_site_ensure

Add a site config to apache and enable it.

Example:

apache_site_ensure('iptools', text_strip_margin('''
    |<VirtualHost *:80>
    |    ServerName iptools
    |    DocumentRoot /var/www/iptools
    |    <Directory /var/www/iptools>
    |    </Directory>
    |</VirtualHost>
'''))