Merge pull request #258036 from anthonyroussel/fix-ssm-seelog

nixos/amazon-ssm-agent: fix missing seelog.xml file
This commit is contained in:
Mario Rodas 2023-11-19 18:55:57 -05:00 committed by GitHub
commit fa14a14694
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 32 additions and 7 deletions

View file

@ -33,19 +33,22 @@ in {
};
config = mkIf cfg.enable {
# See https://github.com/aws/amazon-ssm-agent/blob/mainline/packaging/linux/amazon-ssm-agent.service
systemd.services.amazon-ssm-agent = {
inherit (cfg.package.meta) description;
after = [ "network.target" ];
after = [ "network-online.target" ];
wantedBy = [ "multi-user.target" ];
path = [ fake-lsb-release pkgs.coreutils ];
serviceConfig = {
ExecStart = "${cfg.package}/bin/amazon-ssm-agent";
KillMode = "process";
# We want this restating pretty frequently. It could be our only means
# of accessing the instance.
Restart = "always";
RestartSec = "1min";
RestartPreventExitStatus = 194;
RestartSec = "90";
};
};
@ -70,7 +73,7 @@ in {
group = "ssm-user";
};
environment.etc."amazon/ssm/seelog.xml".source = "${cfg.package}/seelog.xml.template";
environment.etc."amazon/ssm/seelog.xml".source = "${cfg.package}/etc/amazon/ssm/seelog.xml.template";
environment.etc."amazon/ssm/amazon-ssm-agent.json".source = "${cfg.package}/etc/amazon/ssm/amazon-ssm-agent.json.template";

View file

@ -117,6 +117,7 @@ in {
allTerminfo = handleTest ./all-terminfo.nix {};
alps = handleTest ./alps.nix {};
amazon-init-shell = handleTest ./amazon-init-shell.nix {};
amazon-ssm-agent = handleTest ./amazon-ssm-agent.nix {};
amd-sev = runTest ./amd-sev.nix;
anbox = runTest ./anbox.nix;
anuko-time-tracker = handleTest ./anuko-time-tracker.nix {};

View file

@ -0,0 +1,17 @@
import ./make-test-python.nix ({ lib, pkgs, ... }: {
name = "amazon-ssm-agent";
meta.maintainers = [ lib.maintainers.anthonyroussel ];
nodes.machine = { config, pkgs, ... }: {
services.amazon-ssm-agent.enable = true;
};
testScript = ''
start_all()
machine.wait_for_file("/etc/amazon/ssm/seelog.xml")
machine.wait_for_file("/etc/amazon/ssm/amazon-ssm-agent.json")
machine.wait_for_unit("amazon-ssm-agent.service")
'';
})

View file

@ -11,6 +11,7 @@
, dmidecode
, bashInteractive
, nix-update-script
, nixosTests
, testers
, amazon-ssm-agent
, overrideEtc ? true
@ -147,11 +148,14 @@ buildGoModule rec {
'';
passthru = {
updateScript = nix-update-script { };
tests.version = testers.testVersion {
package = amazon-ssm-agent;
command = "amazon-ssm-agent --version";
tests = {
inherit (nixosTests) amazon-ssm-agent;
version = testers.testVersion {
package = amazon-ssm-agent;
command = "amazon-ssm-agent --version";
};
};
updateScript = nix-update-script { };
};
__darwinAllowLocalNetworking = true;