(ctx *cli.Context)
| 231 | } |
| 232 | |
| 233 | func renewCertificateAction(ctx *cli.Context) error { |
| 234 | err := errs.NumberOfArguments(ctx, 2) |
| 235 | if err != nil { |
| 236 | return err |
| 237 | } |
| 238 | |
| 239 | args := ctx.Args() |
| 240 | certFile := args.Get(0) |
| 241 | keyFile := args.Get(1) |
| 242 | passFile := ctx.String("password-file") |
| 243 | isDaemon := ctx.Bool("daemon") |
| 244 | execCmd := ctx.String("exec") |
| 245 | kmsURI := ctx.String("kms") |
| 246 | |
| 247 | outFile := ctx.String("out") |
| 248 | if outFile == "" { |
| 249 | outFile = certFile |
| 250 | } |
| 251 | |
| 252 | rootFile := ctx.String("root") |
| 253 | if rootFile == "" { |
| 254 | rootFile = pki.GetRootCAPath() |
| 255 | } |
| 256 | |
| 257 | caURL, err := flags.ParseCaURL(ctx) |
| 258 | if err != nil { |
| 259 | return err |
| 260 | } |
| 261 | |
| 262 | var expiresIn, renewPeriod time.Duration |
| 263 | if s := ctx.String("expires-in"); s != "" { |
| 264 | if expiresIn, err = time.ParseDuration(s); err != nil { |
| 265 | return errs.InvalidFlagValue(ctx, "expires-in", s, "") |
| 266 | } |
| 267 | } |
| 268 | if s := ctx.String("renew-period"); s != "" { |
| 269 | if renewPeriod, err = time.ParseDuration(s); err != nil { |
| 270 | return errs.InvalidFlagValue(ctx, "renew-period", s, "") |
| 271 | } |
| 272 | } |
| 273 | if expiresIn > 0 && renewPeriod > 0 { |
| 274 | return errs.IncompatibleFlagWithFlag(ctx, "expires-in", "renew-period") |
| 275 | } |
| 276 | if renewPeriod > 0 && !isDaemon { |
| 277 | return errs.RequiredWithFlag(ctx, "renew-period", "daemon") |
| 278 | } |
| 279 | |
| 280 | if ctx.IsSet("pid") && ctx.IsSet("pid-file") { |
| 281 | return errs.MutuallyExclusiveFlags(ctx, "pid", "pid-file") |
| 282 | } |
| 283 | pid := ctx.Int("pid") |
| 284 | if ctx.IsSet("pid") && pid <= 0 { |
| 285 | return errs.InvalidFlagValue(ctx, "pid", strconv.Itoa(pid), "") |
| 286 | } |
| 287 | |
| 288 | pidFile := ctx.String("pid-file") |
| 289 | if pidFile != "" { |
| 290 | pidB, err := os.ReadFile(pidFile) |
nothing calls this directly
no test coverage detected
searching dependent graphs…