Skip to content

Commit

Permalink
amazon-cloudwatch-publisher: add ptest, fix oelint-adv warn + err
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-roos committed Jan 24, 2023
1 parent 41bc45b commit 6828250
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 32 deletions.
Original file line number Diff line number Diff line change
@@ -1,44 +1,47 @@
# -*- mode: Conf; -*-
SUMMARY = "amazon cloudwatch publisher"
DESCRIPTION = "Push metrics and logs to CloudWatch from any system that can run Python"
HOMEPAGE = "https://github.com/awslabs/amazon-cloudwatch-publisher"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=34400b68072d710fecd0a2940a0d1658"

RDEPENDS:${PN} += " \
python3-boto3 \
python3-psutil \
python3-requests \
python3-timeloop \
"
BRANCH ?= "main"

SRC_URI = "\
git://github.com/awslabs/${BPN};branch=${BRANCH};protocol=https \
file://run-ptest \
"
SRCREV = "9feebfa9facb6bfddade737de7a90bfbfd65cf6e"
S = "${WORKDIR}/git"

inherit systemd
inherit systemd ptest

SYSTEMD_SERVICE:${PN} = "${BPN}.service"
SYSTEMD_AUTO_ENABLE = "enable"

FILES:${PN} += " \
${systemd_system_unitdir}/${BPN}.service \
/opt/aws/${BPN}/${BPN} \
/opt/aws/${BPN}/etc/.gitkeep \
/opt/aws/${BPN}/logs/.gitkeep \
FILES:${PN} += "\
${systemd_system_unitdir}/${BPN}.service \
/opt/aws/${BPN}/${BPN} \
/opt/aws/${BPN}/etc/.gitkeep \
/opt/aws/${BPN}/logs/.gitkeep \
"

BRANCH ?= "main"

SRC_URI += "git://github.com/awslabs/${BPN};branch=${BRANCH};protocol=https"
SRCREV = "9feebfa9facb6bfddade737de7a90bfbfd65cf6e"
S = "${WORKDIR}/git"
RDEPENDS:${PN} += "\
python3-boto3 \
python3-psutil \
python3-requests \
python3-timeloop \
"

do_install() {
install -d ${D}${systemd_system_unitdir}
install -d ${D}/opt/aws/${BPN}/etc
touch ${D}/opt/aws/${BPN}/etc/.gitkeep
install -d ${D}/opt/aws/${BPN}/logs
touch ${D}/opt/aws/${BPN}/logs/.gitkeep
install -m 744 ${BPN} ${D}/opt/aws/${BPN}/

# TODO: user and group should be cwpublisher/wheel
cat <<-EOF > ${D}${systemd_system_unitdir}/${BPN}.service
install -d ${D}${systemd_system_unitdir}
install -d ${D}/opt/aws/${BPN}/etc
touch ${D}/opt/aws/${BPN}/etc/.gitkeep
install -d ${D}/opt/aws/${BPN}/logs
touch ${D}/opt/aws/${BPN}/logs/.gitkeep
install -m 744 ${BPN} ${D}/opt/aws/${BPN}/

# TODO: user and group should be cwpublisher/wheel
cat <<-EOF > ${D}${systemd_system_unitdir}/${BPN}.service
[Unit]
Description=Push metrics and logs to CloudWatch from any system that can run Python
DefaultDependencies=no
Expand Down
15 changes: 15 additions & 0 deletions recipes-cloud/amazon-cloudwatch-publisher/files/run-ptest
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh
set -euxo pipefail

cd /opt/aws/amazon-cloudwatch-publisher

./amazon-cloudwatch-publisher &
sleep 30
grep "Instance ID is" /opt/aws/amazon-cloudwatch-publisher/logs/amazon-cloudwatch-publisher.log

RETVAL=$?
if [ $RETVAL -eq 0 ] ; then
echo "PASS: amazon-cloudwatch-publisher: startup test"
else
echo "FAIL: amazon-cloudwatch-publisher: startup test"
fi
9 changes: 4 additions & 5 deletions recipes-external/python3-timeloop/python3-timeloop_1.0.2.bb
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
SUMMARY = "Timeloop"
DESCRIPTION = ""
HOMEPAGE = ""
DESCRIPTION = "An elegant periodic task executor "
HOMEPAGE = "https://github.com/sankalpjonn/timeloop"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://LICENSE;md5=030635eb18c38d9fd120c13a324721b7"

inherit setuptools3

SRC_URI = "git://github.com/sankalpjonn/timeloop.git;protocol=https;branch=master"
SRCREV = "36ec5cbb133a6dcfb5316f59b5e11765c14e62c2"

S = "${WORKDIR}/git"

RDEPENDS:${PN} += "python3-core"
inherit setuptools3

RDEPENDS:${PN} += "python3-core"

0 comments on commit 6828250

Please sign in to comment.