Skip to content

Commit 88267fb

Browse files
author
Power Cloud Robot
authored
Merge pull request #163 from bkhadars/master
Remove --ostype from import sub-command
2 parents 277147c + 9b28933 commit 88267fb

File tree

4 files changed

+4
-14
lines changed

4 files changed

+4
-14
lines changed

cmd/image/import/import.go

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ pvsadm image import -n upstream-core-lon04 -b <BUCKETNAME> --accesskey <ACCESSKE
5858
pvsadm image import -n upstream-core-lon04 -b <BUCKETNAME> --pvs-storagetype <STORAGETYPE> --object rhel-83-10032020.ova.gz --pvs-image-name test-image -r <REGION>
5959
6060
# If user wants to specify the type of OS
61-
pvsadm image import -n upstream-core-lon04 -b <BUCKETNAME> --object rhel-83-10032020.ova.gz --pvs-image-name test-image --ostype <OSTYPE> -r <REGION>
61+
pvsadm image import -n upstream-core-lon04 -b <BUCKETNAME> --object rhel-83-10032020.ova.gz --pvs-image-name test-image -r <REGION>
6262
`,
6363
PreRunE: func(cmd *cobra.Command, args []string) error {
6464
if pkg.ImageCMDOptions.InstanceID == "" && pkg.ImageCMDOptions.InstanceName == "" {
@@ -72,14 +72,8 @@ pvsadm image import -n upstream-core-lon04 -b <BUCKETNAME> --object rhel-83-1003
7272
opt := pkg.ImageCMDOptions
7373
apikey := pkg.Options.APIKey
7474
//validate inputs
75-
validOsType := []string{"aix", "ibmi", "redhat", "sles"}
7675
validStorageType := []string{"tier3", "tier1"}
7776

78-
if opt.OsType != "" && !utils.Contains(validOsType, strings.ToLower(opt.OsType)) {
79-
klog.Errorf("Provide valid OsType.. allowable values are [aix, ibmi, redhat, sles]")
80-
os.Exit(1)
81-
}
82-
8377
if !utils.Contains(validStorageType, strings.ToLower(opt.StorageType)) {
8478
klog.Errorf("Provide valid StorageType.. allowable values are [tier1, tier3]")
8579
os.Exit(1)
@@ -189,7 +183,7 @@ pvsadm image import -n upstream-core-lon04 -b <BUCKETNAME> --object rhel-83-1003
189183
}
190184

191185
image, err := pvmclient.ImgClient.ImportImage(pvmclient.InstanceID, opt.ImageName, opt.ImageFilename, opt.Region,
192-
opt.AccessKey, opt.SecretKey, opt.BucketName, strings.ToLower(opt.OsType), strings.ToLower(opt.StorageType))
186+
opt.AccessKey, opt.SecretKey, opt.BucketName, strings.ToLower(opt.StorageType))
193187
if err != nil {
194188
return err
195189
}
@@ -235,7 +229,6 @@ func init() {
235229
Cmd.Flags().StringVar(&pkg.ImageCMDOptions.AccessKey, "accesskey", "", "Cloud Object Storage HMAC access key.")
236230
Cmd.Flags().StringVar(&pkg.ImageCMDOptions.SecretKey, "secretkey", "", "Cloud Object Storage HMAC secret key.")
237231
Cmd.Flags().StringVar(&pkg.ImageCMDOptions.ImageName, "pvs-image-name", "", "Name to PowerVS imported image.")
238-
Cmd.Flags().StringVar(&pkg.ImageCMDOptions.OsType, "ostype", "redhat", "Image OS Type, accepted values are[aix, ibmi, redhat, sles].")
239232
Cmd.Flags().BoolVarP(&pkg.ImageCMDOptions.Watch, "watch", "w", false, "After image import watch for image to be published and ready to use")
240233
Cmd.Flags().DurationVar(&pkg.ImageCMDOptions.WatchTimeout, "watch-timeout", 1*time.Hour, "watch timeout")
241234
Cmd.Flags().StringVar(&pkg.ImageCMDOptions.StorageType, "pvs-storagetype", "tier3", "PowerVS Storage type, accepted values are [tier1, tier3].")

docs/How to Import Image to PowerVS Instance.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ Flags:
1818
-i, --instance-id string Instance ID of the PowerVS instance
1919
-n, --instance-name string Instance name of the PowerVS
2020
-o, --object-name string Cloud Storage image filename
21-
--ostype string Image OS Type, accepted values are[aix, ibmi, redhat, sles] (default "redhat")
2221
-r, --region string COS bucket location
2322
--secretkey string Cloud Storage secret key
2423
--service-credential-name string Service Credential name to be auto generated (default "pvsadm-service-cred")
@@ -53,5 +52,5 @@ $pvsadm image import -n <POWERVS_INSTANCE_NAME> -b <BUCKETNAME> --object rhel-83
5352
### case 4:
5453
If user wants to specify type of OS
5554
```shell
56-
$pvsadm image import -n <POWERVS_INSTANCE_NAME> -b <BUCKETNAME> --object rhel-83-10032020.ova.gz --pvs-image-name test-image -r <REGION> --ostype <OSTYPE>
55+
$pvsadm image import -n <POWERVS_INSTANCE_NAME> -b <BUCKETNAME> --object rhel-83-10032020.ova.gz --pvs-image-name test-image -r <REGION>
5756
```

pkg/client/image/image.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func (c *Client) Delete(id string) error {
5656
}
5757

5858
//func ImportImage imports image from S3 Instance
59-
func (c *Client) ImportImage(instanceID, imageName, s3Filename, region, accessKey, secretKey, bucketName, osType, storageType string) (*models.Image, error) {
59+
func (c *Client) ImportImage(instanceID, imageName, s3Filename, region, accessKey, secretKey, bucketName, storageType string) (*models.Image, error) {
6060
var source = "url"
6161
var body = models.CreateImage{
6262
ImageName: imageName,
@@ -65,7 +65,6 @@ func (c *Client) ImportImage(instanceID, imageName, s3Filename, region, accessKe
6565
AccessKey: accessKey,
6666
SecretKey: secretKey,
6767
BucketName: bucketName,
68-
OsType: osType,
6968
DiskType: storageType,
7069
Source: &source,
7170
}

pkg/options.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ type imageCMDOptions struct {
6464
ImageFilename string
6565
AccessKey string
6666
SecretKey string
67-
OsType string
6867
StorageType string
6968
InstanceID string
7069
ServiceCredName string

0 commit comments

Comments
 (0)