(cmd *cobra.Command, args []string)
| 131 | } |
| 132 | |
| 133 | func preRun(cmd *cobra.Command, args []string) error { |
| 134 | cmd.Root().SilenceErrors = true |
| 135 | cmd.Root().SilenceUsage = true |
| 136 | |
| 137 | if err := setUpLoggers(); err != nil { |
| 138 | return err |
| 139 | } |
| 140 | |
| 141 | logrus.Debugf("Running as real user ID %s", currentUser.Uid) |
| 142 | logrus.Debugf("Resolved absolute path to the executable as %s", executable) |
| 143 | |
| 144 | if !utils.IsInsideContainer() { |
| 145 | logrus.Debugf("Running on a cgroups v%d host", cgroupsVersion) |
| 146 | |
| 147 | if _, err := validateSubIDRanges(cmd, args, currentUser); err != nil { |
| 148 | return err |
| 149 | } |
| 150 | } |
| 151 | |
| 152 | toolbxDelayEntryPoint := os.Getenv("TOOLBX_DELAY_ENTRY_POINT") |
| 153 | logrus.Debugf("TOOLBX_DELAY_ENTRY_POINT is %s", toolbxDelayEntryPoint) |
| 154 | |
| 155 | toolbxFailEntryPoint := os.Getenv("TOOLBX_FAIL_ENTRY_POINT") |
| 156 | logrus.Debugf("TOOLBX_FAIL_ENTRY_POINT is %s", toolbxFailEntryPoint) |
| 157 | |
| 158 | toolboxPath := os.Getenv("TOOLBOX_PATH") |
| 159 | |
| 160 | if toolboxPath == "" { |
| 161 | if utils.IsInsideContainer() { |
| 162 | if err := preRunIsCoreOSBug(); err != nil { |
| 163 | return err |
| 164 | } |
| 165 | |
| 166 | return errors.New("TOOLBOX_PATH not set") |
| 167 | } |
| 168 | |
| 169 | os.Setenv("TOOLBOX_PATH", executable) |
| 170 | toolboxPath = os.Getenv("TOOLBOX_PATH") |
| 171 | } |
| 172 | |
| 173 | logrus.Debugf("TOOLBOX_PATH is %s", toolboxPath) |
| 174 | |
| 175 | if err := migrate(cmd, args); err != nil { |
| 176 | return err |
| 177 | } |
| 178 | |
| 179 | if err := utils.SetUpConfiguration(); err != nil { |
| 180 | return err |
| 181 | } |
| 182 | |
| 183 | return nil |
| 184 | } |
| 185 | |
| 186 | func rootHelp(cmd *cobra.Command, args []string) { |
| 187 | if utils.IsInsideContainer() { |
nothing calls this directly
no test coverage detected
searching dependent graphs…