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

MGMT-9451: Moving to new service-agent protocol #76

Open
wants to merge 17 commits into
base: igal/new_agent_protocol
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
MGMT-9451: add new commands , install
  • Loading branch information
tsorya committed Mar 23, 2022
commit 3faaf783a6580c27dd3711d7e7b03f4527fb2b10
24 changes: 11 additions & 13 deletions internal/host/hostcommands/install_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ type installCmd struct {
versionsHandler versions.Handler
}


func NewInstallCmd(log logrus.FieldLogger, db *gorm.DB, hwValidator hardware.Validator, ocRelease oc.Release,
instructionConfig InstructionConfig, eventsHandler eventsapi.Handler, versionsHandler versions.Handler) *installCmd {
return &installCmd{
Expand Down Expand Up @@ -103,18 +102,18 @@ func (i *installCmd) getFullInstallerCommand(cluster *common.Cluster, host *mode
}

request := models.InstallCmdRequest{
Role: &role,
BaseURL: swag.String(strings.TrimSpace(i.instructionConfig.ServiceBaseURL)),
ClusterID: host.ClusterID,
HostID: host.ID,
InfraEnvID: &host.InfraEnvID,
Insecure: swag.Bool(i.instructionConfig.SkipCertVerification),
Bootdevice:swag.String(bootdevice),
Role: &role,
BaseURL: swag.String(strings.TrimSpace(i.instructionConfig.ServiceBaseURL)),
ClusterID: host.ClusterID,
HostID: host.ID,
InfraEnvID: &host.InfraEnvID,
Insecure: swag.Bool(i.instructionConfig.SkipCertVerification),
Bootdevice: swag.String(bootdevice),
HighAvailabilityMode: &haMode,
ControllerImage: swag.String(i.instructionConfig.ControllerImage),
DisksToFormat: disksToFormat,
CheckCvo: swag.Bool(i.instructionConfig.CheckClusterVersion),
InstallerImage: swag.String(i.instructionConfig.InstallerImage),
ControllerImage: swag.String(i.instructionConfig.ControllerImage),
DisksToFormat: disksToFormat,
CheckCvo: swag.Bool(i.instructionConfig.CheckClusterVersion),
InstallerImage: swag.String(i.instructionConfig.InstallerImage),
}

// those flags are not used on day2 installation
Expand Down Expand Up @@ -222,7 +221,6 @@ func (i *installCmd) getMustGatherArgument(mustGatherMap versions.MustGatherVers
return string(arg), nil
}


func (i *installCmd) hasCACert() bool {
return i.instructionConfig.ServiceCACertPath != ""
}
Expand Down
10 changes: 1 addition & 9 deletions internal/host/hostcommands/install_cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ var _ = Describe("installcmd arguments", func() {

BeforeSuite(func() {
db, dbName = common.PrepareTestDB()
cluster = createClusterInDb(db, string(models.ClusterHighAvailabilityModeNone))
cluster = createClusterInDb(db, models.ClusterHighAvailabilityModeNone)
infraEnv = createInfraEnvInDb(db, *cluster.ID)
infraEnvId = *infraEnv.ID
host = createHostInDb(db, infraEnvId, *cluster.ID, models.HostRoleMaster, false, "")
Expand Down Expand Up @@ -999,7 +999,6 @@ func getBootableDiskNames(disks []*models.Disk) []string {
}).([]string)
}


func getRequest(reply *models.Step) *models.InstallCmdRequest {
request := models.InstallCmdRequest{}
err := json.Unmarshal([]byte(reply.Args[0]), &request)
Expand All @@ -1026,13 +1025,6 @@ func verifyDiskFormatCommand(command string, value string, exists bool) {
Expect(matchValue()).To(Equal(exists))
}

func quoteString(value string) string {
if strings.ContainsRune(value, '"') && !(strings.Index(value, "'") == 0) {
return fmt.Sprintf("'%s'", value)
}
return value
}

func createClusterInDb(db *gorm.DB, haMode string) common.Cluster {
clusterId := strfmt.UUID(uuid.New().String())
cluster := common.Cluster{Cluster: models.Cluster{
Expand Down