mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 21:50:33 +03:00
nixos/mesos: Parameterize mesos slave attributes
Added attributes to nixos/tests/mesos.nix to verify that mesos-slave attributes work. If the generated attributes are invalid, the daemon should fail to start. Change-Id: I5511245add30aba658b1af22cd7355b0bbf5d15c
This commit is contained in:
parent
718666204a
commit
c47cefd05e
2 changed files with 43 additions and 18 deletions
|
@ -5,6 +5,13 @@ with lib;
|
|||
let
|
||||
cfg = config.services.mesos.slave;
|
||||
|
||||
mkAttributes =
|
||||
attrs: concatStringsSep ";" (mapAttrsToList
|
||||
(k: v: "${k}:${v}")
|
||||
(filterAttrs (k: v: v != null) attrs));
|
||||
attribsArg = optionalString (cfg.attributes != {})
|
||||
"--attributes=${mkAttributes cfg.attributes}";
|
||||
|
||||
in {
|
||||
|
||||
options.services.mesos = {
|
||||
|
@ -62,6 +69,19 @@ in {
|
|||
type = types.str;
|
||||
};
|
||||
|
||||
attributes = mkOption {
|
||||
description = ''
|
||||
Machine attributes for the slave instance.
|
||||
|
||||
Use caution when changing this; you may need to manually reset slave
|
||||
metadata before the slave can re-register.
|
||||
'';
|
||||
default = {};
|
||||
type = types.attrsOf types.str;
|
||||
example = { rack = "aa";
|
||||
host = "aabc123";
|
||||
os = "nixos"; };
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
|
@ -79,6 +99,7 @@ in {
|
|||
--port=${toString cfg.port} \
|
||||
--master=${cfg.master} \
|
||||
${optionalString cfg.withHadoop "--hadoop-home=${pkgs.hadoop}"} \
|
||||
${attribsArg} \
|
||||
--work_dir=${cfg.workDir} \
|
||||
--logging_level=${cfg.logLevel} \
|
||||
--docker=${pkgs.docker}/libexec/docker/docker \
|
||||
|
|
|
@ -8,6 +8,10 @@ import ./make-test.nix {
|
|||
slave = {
|
||||
enable = true;
|
||||
master = "zk://localhost:2181/mesos";
|
||||
attributes = {
|
||||
tag1 = "foo";
|
||||
tag2 = "bar";
|
||||
};
|
||||
};
|
||||
master = {
|
||||
enable = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue