mirror of
https://github.com/strongdm/comply
synced 2024-11-05 07:25:26 +00:00
never pull the docker container if pandoc is present and working in the PATH
This commit is contained in:
parent
4969d179ec
commit
4d830789ec
@ -106,12 +106,18 @@ func pandocMustExist(c *cli.Context) error {
|
||||
|
||||
pandocExistErr := pandocBinaryMustExist(c)
|
||||
dockerExistErr := dockerMustExist(c)
|
||||
|
||||
config.SetPandoc(pandocExistErr == nil, dockerExistErr == nil)
|
||||
|
||||
if pandocExistErr != nil && dockerExistErr != nil {
|
||||
return eitherMustExistErr
|
||||
}
|
||||
|
||||
// if we don't have pandoc, but we do have docker, execute a pull
|
||||
if pandocExistErr != nil && dockerExistErr == nil {
|
||||
dockerPull(c)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -170,6 +176,23 @@ func dockerMustExist(c *cli.Context) error {
|
||||
return dockerErr
|
||||
}
|
||||
|
||||
_, err = cli.Ping(ctx)
|
||||
if err != nil {
|
||||
return dockerErr
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func dockerPull(c *cli.Context) error {
|
||||
dockerErr := fmt.Errorf("Docker must be available in order to run `%s`", c.Command.Name)
|
||||
|
||||
ctx := context.Background()
|
||||
cli, err := client.NewEnvClient()
|
||||
if err != nil {
|
||||
return dockerErr
|
||||
}
|
||||
|
||||
done := make(chan struct{})
|
||||
defer close(done)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user