File tree 1 file changed +72
-6
lines changed
1 file changed +72
-6
lines changed Original file line number Diff line number Diff line change 1
- { ...} : {
2
- config . system . activationScripts . onlineActivation = ''
3
- if [ -z '' ${FLEET_ONLINE_ACTIVATION+x} ]; then
4
- 1>&2 echo "online activation; hello, fleet!"
5
- fi
6
- '' ;
1
+ {
2
+ config ,
3
+ lib ,
4
+ ...
5
+ } : let
6
+ inherit ( lib . options ) mkOption ;
7
+ inherit ( lib . types ) attrsOf str submodule either listOf lines bool ;
8
+ inherit ( lib . attrsets ) mapAttrs ;
9
+ inherit ( lib . trivial ) isString ;
10
+ in {
11
+ options . system . onlineActivationScripts = mkOption {
12
+ default = { } ;
13
+ type = attrsOf ( either str ( submodule {
14
+ options = {
15
+ deps = mkOption {
16
+ type = listOf str ;
17
+ default = [ ] ;
18
+ } ;
19
+ text = mkOption {
20
+ type = lines ;
21
+ } ;
22
+ supportsDryActivation = mkOption {
23
+ type = bool ;
24
+ default = false ;
25
+ } ;
26
+ } ;
27
+ } ) ) ;
28
+ description = ''
29
+ Same as activation scripts, but only ran on online activation (i.e when operator is actively running fleet deploy, and not on system restart)
30
+
31
+ Can be used to apply configuration such as ceph monitor maps, which is required to be up-to-date to correctly function,
32
+ we should not apply outdated ceph monmap.
33
+ '' ;
34
+
35
+ apply = set :
36
+ mapAttrs (
37
+ name : value :
38
+ if isString value
39
+ then {
40
+ text = ''
41
+ if [ ! -z '' ${FLEET_ONLINE_ACTIVATION+x} ]; then
42
+ ${ value }
43
+ fi
44
+ '' ;
45
+ deps = [ "onlineActivation" ] ;
46
+ }
47
+ else
48
+ value
49
+ // {
50
+ deps = [ "onlineActivation" ] ++ value . deps ;
51
+ text = ''
52
+ if [ ! -z '' ${FLEET_ONLINE_ACTIVATION+x} ]; then
53
+ ${ value . text }
54
+ fi
55
+ '' ;
56
+ }
57
+ )
58
+ set ;
59
+ } ;
60
+
61
+ config . system . activationScripts =
62
+ {
63
+ onlineActivation = {
64
+ text = ''
65
+ if [ ! -z '' ${FLEET_ONLINE_ACTIVATION+x} ]; then
66
+ 1>&2 echo "online activation; hello, fleet!"
67
+ fi
68
+ '' ;
69
+ supportsDryActivation = true ;
70
+ } ;
71
+ }
72
+ // config . system . onlineActivationScripts ;
7
73
}
You can’t perform that action at this time.
0 commit comments