Skip to content

amazon-cloudwatch-agent-ctl -a append-config spurious failures #2081

@Alex-Vol-Amz

Description

@Alex-Vol-Amz

Describe the bug
Random failures occur when the code in amazon-cloudwatch-agent-ctl script at

for file in "${JSON_DIR}"/*.tmp; do
mv -f "${file}" "${JSON_DIR}/$(basename "${file}" .tmp)"
done
attempts to iterate over a glob expression that does not resolve to any files.

Steps to reproduce
Unknown when or how this happens, it seems random. Most of the time it works then once every several executions it exits with that error message.

What did you expect to see?
No errors, exit code 0.

What did you see instead?

Error output:

mv: cannot stat '/opt/aws/amazon-cloudwatch-agent/etc/amazon-cloudwatch-agent.d/*.tmp': No such file or directory

What version did you use?

Version: amazon-cloudwatch-agent-1.300066.0b1367-1.x86_64

What config did you use?
Config: Using defaults and appending a simple extra files config. Does not matter what the config file is, it fails only on rare occasions without changes in the config.

Environment
OS: Amazon Linux 2

Additional context
None

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions