Skip to content

Commit

Permalink
Merge pull request #12 from ppc64le-cloud/update_help
Browse files Browse the repository at this point in the history
Update usage
  • Loading branch information
mkumatag authored Oct 12, 2020
2 parents 0567f32 + b35c8c5 commit dfde876
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 5 deletions.
4 changes: 3 additions & 1 deletion cmd/purge/images/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ const deletePromptMessage = "Deleting all the above images, images can't be clai
var Cmd = &cobra.Command{
Use: "images",
Short: "Purge the powervs images",
Long: `Purge the powervs images!`,
Long: `Purge the powervs images!
pvsadm purge --help for information
`,
RunE: func(cmd *cobra.Command, args []string) error {
klog.Infof("Purge the images for the instance: %v", pkg.Options.InstanceID)
opt := pkg.Options
Expand Down
4 changes: 3 additions & 1 deletion cmd/purge/networks/networks.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ const deletePromptMessage = "Deleting all the above networks, networks can't be
var Cmd = &cobra.Command{
Use: "networks",
Short: "Purge the powervs networks",
Long: `Purge the powervs networks!`,
Long: `Purge the powervs networks!
pvsadm purge --help for information
`,
RunE: func(cmd *cobra.Command, args []string) error {
opt := pkg.Options

Expand Down
31 changes: 30 additions & 1 deletion cmd/purge/purge.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,36 @@ import (
var Cmd = &cobra.Command{
Use: "purge",
Short: "Purge the powervs resources",
Long: `Purge the powervs resources`,
Long: `Purge the powervs resources
# Set the API key or feed the --api-key commandline argument
export IBMCLOUD_API_KEY=<IBM_CLOUD_API_KEY>
Examples:
# Delete all the virtual machines which are created before 4hrs
pvsadm purge vms --instance-name upstream-core --before 4h
# Delete all the virtual machines created since 24hrs
pvsadm purge vms --instance-name upstream-core --since 24h
# Delete all the volumes which aren't assigned to any virtual machines
pvsadm purge volumes --instance-name upstream-core
# Delete all the networks and ignore if any errors during the delete operation
pvsadm purge networks --instance-name upstream-core --ignore-errors
# Delete all the images without asking any confirmation
pvsadm purge images --instance-name upstream-core --no-prompt
# Delete all the images with debugging logs for IBM cloud APIs
pvsadm purge images --instance-name upstream-core --debug
# Delete all the virtual machines starts with k8s-cluster-
pvsadm purge vms --instance-name upstream-core --regexp "^k8s-cluster-.*"
# List the purgeable candidate virtual machines and exit without deleting
pvsadm purge vms --instance-name upstream-core --dry-run
`,
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
if pkg.Options.Since != 0 && pkg.Options.Before != 0 {
return fmt.Errorf("--since and --before options can not be set at a time")
Expand Down
4 changes: 3 additions & 1 deletion cmd/purge/vms/vms.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ const deletePromptMessage = "Deleting all the above instances, instances can't b
var Cmd = &cobra.Command{
Use: "vms",
Short: "Purge the powervs vms",
Long: `Purge the powervs vms!`,
Long: `Purge the powervs vms!
pvsadm purge --help for information
`,
RunE: func(cmd *cobra.Command, args []string) error {
opt := pkg.Options

Expand Down
4 changes: 3 additions & 1 deletion cmd/purge/volumes/volumes.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ const deletePromptMessage = "Deleting all the volumes in available state, volume
var Cmd = &cobra.Command{
Use: "volumes",
Short: "Purge the powervs volumes",
Long: `Deletes all the volumes for the powervs instance which are in available state(not attached to any instances)`,
Long: `Deletes all the volumes for the powervs instance which are in available state(not attached to any instances)
pvsadm purge --help for information
`,
RunE: func(cmd *cobra.Command, args []string) error {
opt := pkg.Options

Expand Down

0 comments on commit dfde876

Please sign in to comment.