Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge hardware and target. #88

Merged
merged 8 commits into from
May 9, 2020
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 0 additions & 26 deletions cli/tink/cmd/target.go

This file was deleted.

59 changes: 0 additions & 59 deletions cli/tink/cmd/target/commands.go

This file was deleted.

35 changes: 0 additions & 35 deletions cli/tink/cmd/target/create.go

This file was deleted.

32 changes: 0 additions & 32 deletions cli/tink/cmd/target/delete.go

This file was deleted.

34 changes: 0 additions & 34 deletions cli/tink/cmd/target/get.go

This file was deleted.

58 changes: 0 additions & 58 deletions cli/tink/cmd/target/list.go

This file was deleted.

59 changes: 0 additions & 59 deletions cli/tink/cmd/target/update.go

This file was deleted.

15 changes: 5 additions & 10 deletions cli/tink/cmd/workflow/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import (

var (
fTemplate = "template"
fTarget = "target"
fHardware = "hardware"
template string
target string
hardware string
)

// createCmd represents the create subcommand for worflow command
Expand All @@ -25,11 +25,6 @@ var createCmd = &cobra.Command{
PreRunE: func(c *cobra.Command, args []string) error {
tmp, _ := c.Flags().GetString(fTemplate)
err := validateID(tmp)
if err != nil {
return err
}
tar, _ := c.Flags().GetString(fTarget)
err = validateID(tar)
return err
},
Run: func(c *cobra.Command, args []string) {
Expand All @@ -40,14 +35,14 @@ var createCmd = &cobra.Command{
func addFlags() {
flags := createCmd.PersistentFlags()
flags.StringVarP(&template, "template", "t", "", "workflow template")
flags.StringVarP(&target, "target", "r", "", "workflow target")
flags.StringVarP(&hardware, "hardware", "r", "", "workflow target hardwares")
parauliya marked this conversation as resolved.
Show resolved Hide resolved
parauliya marked this conversation as resolved.
Show resolved Hide resolved

createCmd.MarkPersistentFlagRequired(fTarget)
createCmd.MarkPersistentFlagRequired(fHardware)
createCmd.MarkPersistentFlagRequired(fTemplate)
}

func createWorkflow(c *cobra.Command, args []string) {
req := workflow.CreateRequest{Template: template, Target: target}
req := workflow.CreateRequest{Template: template, Target: hardware}
parauliya marked this conversation as resolved.
Show resolved Hide resolved
res, err := client.WorkflowClient.CreateWorkflow(context.Background(), &req)
if err != nil {
log.Fatal(err)
Expand Down
11 changes: 4 additions & 7 deletions client/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,17 @@ import (
"net/http"
"os"

"github.com/pkg/errors"
"github.com/tinkerbell/tink/protos/hardware"
"github.com/tinkerbell/tink/protos/target"
"github.com/tinkerbell/tink/protos/template"
"github.com/tinkerbell/tink/protos/workflow"
"github.com/pkg/errors"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
)

// gRPC clients
var (
TemplateClient template.TemplateClient
TargetClient target.TargetClient
WorkflowClient workflow.WorkflowSvcClient
HardwareClient hardware.HardwareServiceClient
)
Expand Down Expand Up @@ -66,15 +64,14 @@ func Setup() {
log.Fatal(err)
}
TemplateClient = template.NewTemplateClient(conn)
TargetClient = target.NewTargetClient(conn)
WorkflowClient = workflow.NewWorkflowSvcClient(conn)
HardwareClient = hardware.NewHardwareServiceClient(conn)
}

func NewTinkerbellClient() (hardware.HardwareServiceClient, error) {
conn, err := GetConnection()
if err != nil {
log.Fatal(err)
}
if err != nil {
log.Fatal(err)
}
return hardware.NewHardwareServiceClient(conn), nil
}
Loading