Skip to content

[cli] refactor the LambdaPackage to use setuptools for function management #1156

@ryandeivert

Description

@ryandeivert

related to: #1153

Background

The current LambdaPackage class has a fairly janky method of managing dependencies and creating deployment packages.

Proposal

  • Add a setuptools setup.pyto each streamalert/<function>/ directory (where <function> is a directory for any lambda function code)
    • Note: this might require a change to the folder structure. Alternatively, we could create a lambdas directory or something similar that just implements the handlers and imports code from other packages (?)
  • Have the setup.py for each lambda function define the required libraries needed. We would also specify data_files for setuptools to include config/etc. This all is currently done in a jank way here:
    package_files = {
    'conf',
    'streamalert/__init__.py',
    'streamalert/classifier',
    'streamalert/shared',
    }
    package_name = 'classifier'
    package_libs = {'jmespath', 'jsonlines'}
  • Use pip to install from each function's setup.py to target install to a directory.
  • Remove the "zipping" logic we currently have for creating the archive in favor of using the archive_file feature in Terraform.

Note

This would require(?) the use of vagrant for installing via pip. See #1153

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions