mkRemovedOptionModule: assert on removed options (#69419)
mkRemovedOptionModule: assert on removed options
This commit is contained in:
commit
c75a18fea6
|
@ -592,11 +592,14 @@ rec {
|
||||||
{ options = setAttrByPath optionName (mkOption {
|
{ options = setAttrByPath optionName (mkOption {
|
||||||
visible = false;
|
visible = false;
|
||||||
});
|
});
|
||||||
config.warnings =
|
config.assertions =
|
||||||
let opt = getAttrFromPath optionName options; in
|
let opt = getAttrFromPath optionName options; in [{
|
||||||
optional opt.isDefined ''
|
assertion = !opt.isDefined;
|
||||||
|
message = ''
|
||||||
The option definition `${showOption optionName}' in ${showFiles opt.files} no longer has any effect; please remove it.
|
The option definition `${showOption optionName}' in ${showFiles opt.files} no longer has any effect; please remove it.
|
||||||
${replacementInstructions}'';
|
${replacementInstructions}
|
||||||
|
'';
|
||||||
|
}];
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Return a module that causes a warning to be shown if the
|
/* Return a module that causes a warning to be shown if the
|
||||||
|
|
|
@ -49,6 +49,6 @@ in
|
||||||
(mkRemovedOptionModule [ "insecure" ] ''
|
(mkRemovedOptionModule [ "insecure" ] ''
|
||||||
This option was replaced by 'prometheus.exporters.nginx.sslVerify'.
|
This option was replaced by 'prometheus.exporters.nginx.sslVerify'.
|
||||||
'')
|
'')
|
||||||
({ options.warnings = options.warnings; })
|
({ options.warnings = options.warnings; options.assertions = options.assertions; })
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -305,7 +305,7 @@ let
|
||||||
optional (defined ipv6Address && defined ipv6PrefixLength)
|
optional (defined ipv6Address && defined ipv6PrefixLength)
|
||||||
{ address = ipv6Address; prefixLength = ipv6PrefixLength; }))
|
{ address = ipv6Address; prefixLength = ipv6PrefixLength; }))
|
||||||
|
|
||||||
({ options.warnings = options.warnings; })
|
({ options.warnings = options.warnings; options.assertions = options.assertions; })
|
||||||
];
|
];
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue