-
-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
|
||
helper "github.com/home-assistant/cli/client" | ||
log "github.com/sirupsen/logrus" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var securityIntegrityCmd = &cobra.Command{ | ||
Use: "integrity", | ||
Aliases: []string{"int", "trust"}, | ||
Short: "Execute security integrity check", | ||
Long: ` | ||
This command execute a full system integrity check. | ||
This need content trust to be enabled.`, | ||
Example: ` | ||
ha security integrity`, | ||
Run: func(cmd *cobra.Command, args []string) { | ||
log.WithField("args", args).Debug("security") | ||
|
||
section := "security" | ||
command := "integrity" | ||
|
||
ProgressSpinner.Start() | ||
resp, err := helper.GenericJSONPost(section, command, nil) | ||
ProgressSpinner.Stop() | ||
|
||
if err != nil { | ||
fmt.Println(err) | ||
ExitWithError = true | ||
} else { | ||
ExitWithError = !helper.ShowJSONResponse(resp) | ||
} | ||
}, | ||
} | ||
|
||
func init() { | ||
// add cmd to root command | ||
securityCmd.AddCommand(securityIntegrityCmd) | ||
} |