| 28 | } |
| 29 | |
| 30 | func fillCreateRequest(projectName, bootingPrivateKeyFilePath, ocpPullSecretFilePath string, |
| 31 | args map[string]string) (*createRequest, error) { |
| 32 | imageIDValue, ok := args[imageID] |
| 33 | if !ok { |
| 34 | return nil, fmt.Errorf("imageID not found") |
| 35 | } |
| 36 | networkNameValue, ok := args[networkName] |
| 37 | if !ok { |
| 38 | return nil, fmt.Errorf("openstack-network-name not found") |
| 39 | } |
| 40 | it := ocpInstanceType |
| 41 | if customInstanceType, ok := args[instanceType]; ok { |
| 42 | it = customInstanceType |
| 43 | } |
| 44 | ds := ocpDefaultRootBlockDeviceSize |
| 45 | if customDiskSizeAsString, ok := args[diskSize]; ok { |
| 46 | customDiskSize, err := strconv.Atoi(customDiskSizeAsString) |
| 47 | if err != nil { |
| 48 | return nil, fmt.Errorf("error creating request for cluster machine: %v", err) |
| 49 | } |
| 50 | ds = customDiskSize |
| 51 | } |
| 52 | return &createRequest{ |
| 53 | projectName: projectName, |
| 54 | imageID: imageIDValue, |
| 55 | instanceType: it, |
| 56 | diskSize: ds, |
| 57 | bootingPrivateKeyFilePath: bootingPrivateKeyFilePath, |
| 58 | ocpPullSecretFilePath: ocpPullSecretFilePath, |
| 59 | networkName: networkNameValue}, nil |
| 60 | } |
| 61 | |
| 62 | func (r createRequest) runFunc(ctx *pulumi.Context) error { |
| 63 | privateKey, err := crctls.CreateKey(ctx) |