<s> from provy . core import Role <EOL> from provy . more . debian . package . aptitude import AptitudeRole <EOL> '''<STR_LIT>''' <EOL> class AppArmorRole ( Role ) : <EOL> '''<STR_LIT>''' <EOL> def provision ( self ) : <EOL> '''<STR_LIT>''' <EOL> with self . using ( AptitudeRole ) as aptitude : <EOL> aptitude . ensure_package_installed ( '<STR_LIT>' ) <EOL> aptitude . ensure_package_installed ( '<STR_LIT>' ) <EOL> def __execute_batch ( self , command , executables ) : <EOL> arguments = '<STR_LIT:U+0020>' . join ( executables ) <EOL> command += '<STR_LIT>' % arguments <EOL> self . execute ( command , stdout = False , sudo = True ) <EOL> def disable ( self , * executables ) : <EOL> '''<STR_LIT>''' <EOL> self . __execute_batch ( '<STR_LIT>' , executables ) <EOL> def complain ( self , * executables ) : <EOL> '''<STR_LIT>''' <EOL> self . __execute_batch ( '<STR_LIT>' , executables ) <EOL> def enforce ( self , * executables ) : <EOL> '''<STR_LIT>''' <EOL> self . __execute_batch ( '<STR_LIT>' , executables ) <EOL> def audit ( self , * executables ) : <EOL> '''<STR_LIT>''' <EOL> self . __execute_batch ( '<STR_LIT>' , executables ) <EOL> def create ( self , executable , template = None , policy_groups = None , abstractions = None , read = [ ] , read_and_write = [ ] ) : <EOL> '''<STR_LIT>''' <EOL> command = '<STR_LIT>' <EOL> if template is not None : <EOL> command += '<STR_LIT>' % template <EOL> if policy_groups is not None : <EOL> groups = '<STR_LIT:U+002C>' . join ( policy_groups ) <EOL> command += '<STR_LIT>' % groups <EOL> if abstractions is not None : <EOL> abstr = '<STR_LIT:U+002C>' . join ( abstractions ) <EOL> command += '<STR_LIT>' % abstr <EOL> for path in read : <EOL> command += '<STR_LIT>' % path <EOL> for path in read_and_write : <EOL> command += '<STR_LIT>' % path <EOL> command += '<STR_LIT>' % executable <EOL> self . execute ( command , stdout = False , sudo = True ) </s>
