Starting with Rocks 5.4, file specific plugins have been introduced into the 411 system. These plugins manipulate the content of files before sending files on the frontend, and after reception of the file on the client nodes. The plugins also mangle name of the file, ownership and mode of the file.
The 411 Plugin architecture follows a very simple API. Each plugin is
written in Python and the plugins reside in /opt/rocks/var/plugins/411/. All plugins inherit the
get_filename:This function returns
a the filename on the frontend on which this plugin will function. This
is the only required function in the plugin. All other functions are
import os import sys import stat import rocks.service411 class Plugin(rocks.service411.Plugin): def get_filename(self): return '/etc/auto.master'
filter_name: This function mangles
the filename of the file at the destination, and returns the
def filter_name(self, fname): if fname == '/etc/auto.master' && self.attrs['os'] == 'sunos': return '/etc/auto_master'
filter_owner: This function takes the Owner
UID and group ID of the file as a string argument and returns a mangled
version of the "UID.GID" string. This string is in the format that the
chown command understands.
def filter_owner(self, oid): if self.attrs['os'] == 'linux': return oid if self.attrs['os'] == 'sunos': return '0.0'
filter_mode: This function takes
the mode information as a string, and returns a mangled mode information
string. This should be in the numerical format that the
chmod command understands.
def filter_mode(self, mode): return '010644'
filter_content: This function takes
the contents of the file as a string, manipulates it and returns the
final string to be stored in the file. The example below illustrates
insertion of a blank line between every line of the input content.
pre_send: This function manipulates
the contents of the file before the file is made available for download
over 411. The example below illustrates deletion of all blank lines
from the content.
post: This function is run after
the file is received, filtered and written to disk. The example below
illustrates restarting the autofs service after a file has been written to