INNER CODE UNIT · Go

init

FairwindsOps/polaris · cmd/polaris/fix.go:33

func init() {
	rootCmd.AddCommand(fixCommand)
	fixCommand.PersistentFlags().StringVar(&filesPath, "files-path", "", "mutate and fix one or more YAML files in a specified folder")
	fixCommand.PersistentFlags().BoolVar(&isTemplate, "template", false, "set to true when modifyng a YAML template, like a Helm chart (experimental)")
	fixCommand.PersistentFlags().StringSliceVar(&checksToFix, "checks", []string{}, "Optional flag to specify specific checks to fix eg. checks=hostIPCSet,hostPIDSet and checks=all applies fix to all defined checks mutations")
}

var fixCommand = &cobra.Command{
	Use:   "fix",
	Short: "Fix Infrastructure as code files.",
	Long:  `Fix Infrastructure as code files.`,
	Run: func(cmd *cobra.Command, args []string) {
		logrus.Debug("Setting up controller manager")

		err := fix.Execute(context.Background(), config, filesPath, isTemplate, checksToFix...)
		if err != nil {
			if errors.Is(err, fix.ErrFilesPathRequired) {
				logrus.Error("Please specify a files-path flag")

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…