Skip to content

Erorr: Message is sent even if no match is successful when using the output-files-log-regex method #25

@adybbroe

Description

@adybbroe

I am using a config file like this:

script: /path/to/executables/bin/awsat_l1b_global_data_unzipper.sh
publisher_config:
  output_files_log_regex: "inflating: (.*/W_.*.nc)"
  publisher_settings:
    nameserver: 'localhost'
    name: 'awsat-l1b-global-data-unzipper'
    port: 0
  static_metadata:
    sensor: aws
    format: l1b
  topic: /awsat/l1b/netcdf/eumetsat/global
subscriber_config:
  topics:
    - /awsat/l1b/zip/eumetsat/global/
  nameserver: 'localhost'
  addr_listener: true

But even when the script fails to run nominally (in this case the unzip of the input file) it still generates and sends a message!

I suppose the run_on_files function (inserted below) needs to handle the case when the shell script doesn't return 0?

def run_on_files(command, files):
    """Run the command of files."""
    if not files:
        return
    logger.info(f"Start running command {command} on files {files}")
    try:
        command_to_call = command["command"]
    except TypeError:
        command_to_call = command
    process = Popen([*os.fspath(command_to_call).split(), *files], stdout=PIPE)  # noqa: S603
    out, _ = process.communicate()
    logger.debug(f"After having run the script: {out}")
    return out

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions