(ctx context.Context, desc string, val **policy.OptionalInt, str string, changeCount *int)
| 190 | } |
| 191 | |
| 192 | func applyOptionalInt(ctx context.Context, desc string, val **policy.OptionalInt, str string, changeCount *int) error { |
| 193 | if str == "" { |
| 194 | // not changed |
| 195 | return nil |
| 196 | } |
| 197 | |
| 198 | if str == inheritPolicyString || str == defaultPolicyString { |
| 199 | *changeCount++ |
| 200 | |
| 201 | log(ctx).Infof(" - resetting %q to a default value inherited from parent.", desc) |
| 202 | |
| 203 | *val = nil |
| 204 | |
| 205 | return nil |
| 206 | } |
| 207 | |
| 208 | v, err := strconv.ParseInt(str, 10, 32) |
| 209 | if err != nil { |
| 210 | return errors.Wrapf(err, "can't parse the %v %q", desc, str) |
| 211 | } |
| 212 | |
| 213 | i := policy.OptionalInt(v) |
| 214 | *changeCount++ |
| 215 | |
| 216 | log(ctx).Infof(" - setting %q to %v.", desc, i) |
| 217 | *val = &i |
| 218 | |
| 219 | return nil |
| 220 | } |
| 221 | |
| 222 | func applyOptionalInt64MiB(ctx context.Context, desc string, val **policy.OptionalInt64, str string, changeCount *int) error { |
| 223 | if str == "" { |
no test coverage detected