Skip to content

Commit

Permalink
[#19] Moved audit plugin setup to test hook
Browse files Browse the repository at this point in the history
  • Loading branch information
tempoz authored and trel committed May 25, 2018
1 parent 5d61fbf commit 285254b
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 110 deletions.
11 changes: 4 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,6 @@ install(
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)

install(
FILES
${CMAKE_SOURCE_DIR}/packaging/test_plugin_audit_amqp_server_config.json
DESTINATION ${IRODS_HOME_DIRECTORY}/scripts/irods/test
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)

install(
FILES
${CMAKE_SOURCE_DIR}/packaging/audit_plugin_message_worker.py
Expand Down Expand Up @@ -161,6 +154,10 @@ install(
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)

install(
FILES ${CMAKE_SOURCE_DIR}/add_audit_rule_engine_to_rule_engines.py
DESTINATION var/lib/irods/scripts
)


set(CPACK_PACKAGE_FILE_NAME "irods-rule-engine-plugin-audit-amqp-${IRODS_VERSION}-${IRODS_LINUX_DISTRIBUTION_NAME}${IRODS_LINUX_DISTRIBUTION_VERSION_MAJOR}-${CMAKE_SYSTEM_PROCESSOR}")
Expand Down
25 changes: 25 additions & 0 deletions add_audit_rule_engine_to_rule_engines.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from __future__ import print_function

from irods.configuration import IrodsConfig

def main():
irods_config = IrodsConfig()
irods_config.server_config['plugin_configuration']['rule_engines'].insert(1,
{
"instance_name": "irods_rule_engine_plugin-audit_amqp-instance",
"plugin_name": "irods_rule_engine_plugin-audit_amqp",
"plugin_specific_configuration" : {
"amqp_location" : "ANONYMOUS@localhost:5672",
"amqp_options" : "",
"amqp_topic" : "audit_messages",
"log_path_prefix": "/tmp/irods",
"pep_regex_to_match" : "audit_.*",
"test_mode": "true"
}
}
)
irods_config.server_config["rule_engine_namespaces"].append("audit_")
irods_config.commit(irods_config.server_config, irods_config.server_config_path, make_backup=True)

if __name__ == '__main__':
main()
1 change: 1 addition & 0 deletions irods_consortium_continuous_integration_test_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ def main():
os_specific_directory = irods_python_ci_utilities.append_os_specific_directory(built_packages_root_directory)

irods_python_ci_utilities.install_os_packages_from_files(glob.glob(os.path.join(os_specific_directory, 'irods-rule-engine-plugin-audit-amqp*.{0}'.format(package_suffix))))
irods_python_ci_utilities.subprocess_get_output(['sudo', 'su', '-', 'irods', '-c', 'python2 scripts/add_audit_rule_engine_to_rule_engines.py'], check_rc=True)

install_build_prerequisites()
install_messaging_package(options.message_broker)
Expand Down
3 changes: 1 addition & 2 deletions packaging/test_audit_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

class TestAuditPlugin(unittest.TestCase):
def setUp(self):
shutil.copy('/var/lib/irods/scripts/irods/test/test_plugin_audit_amqp_server_config.json', '/etc/irods/server_config.json')

# Create a test file
self.largetestfile = "largefile.txt"
Expand All @@ -40,7 +39,7 @@ def setUp(self):
def tearDown(self):
filepath = os.path.abspath(self.largetestfile)
if os.path.exists(filepath):
os.unlink(filepath)
os.unlink(filepath)

def test_audit_plugin(self):
filename = self.largetestfile
Expand Down
101 changes: 0 additions & 101 deletions packaging/test_plugin_audit_amqp_server_config.json

This file was deleted.

0 comments on commit 285254b

Please sign in to comment.