Remove kpod rename

Libpod containers are immutable once created. They cannot be
renamed after created. As such remove kpod rename.

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #101
Approved by: baude
This commit is contained in:
Matthew Heon 2017-12-04 13:49:25 -05:00 committed by Atomic Bot
parent 3db735c6d1
commit 9147a56a01
6 changed files with 0 additions and 133 deletions

View File

@ -53,7 +53,6 @@ func main() {
psCommand,
pullCommand,
pushCommand,
renameCommand,
rmCommand,
rmiCommand,
runCommand,

View File

@ -1,49 +0,0 @@
package main
import (
"github.com/pkg/errors"
"github.com/projectatomic/libpod/libkpod"
"github.com/urfave/cli"
)
var (
renameDescription = "Rename a container. Container may be created, running, paused, or stopped"
renameFlags = []cli.Flag{}
renameCommand = cli.Command{
Name: "rename",
Usage: "rename a container",
Description: renameDescription,
Action: renameCmd,
ArgsUsage: "CONTAINER NEW-NAME",
Flags: renameFlags,
}
)
func renameCmd(c *cli.Context) error {
if len(c.Args()) != 2 {
return errors.Errorf("Rename requires a src container name/ID and a dest container name")
}
if err := validateFlags(c, renameFlags); err != nil {
return err
}
config, err := getConfig(c)
if err != nil {
return errors.Wrapf(err, "Could not get config")
}
server, err := libkpod.New(config)
if err != nil {
return errors.Wrapf(err, "could not get container server")
}
defer server.Shutdown()
err = server.Update()
if err != nil {
return errors.Wrapf(err, "could not update list of containers")
}
err = server.ContainerRename(c.Args().Get(0), c.Args().Get(1))
if err != nil {
return errors.Wrapf(err, "could not rename container")
}
return nil
}

View File

@ -931,26 +931,6 @@ _kpod_push() {
esac
}
_kpod_rename() {
local boolean_options="
--help
-h
"
local options_with_args="
"
local all_options="$options_with_args $boolean_options"
case "$cur" in
-*)
COMPREPLY=($(compgen -W "$boolean_options $options_with_args" -- "$cur"))
;;
*)
__kpod_list_containers
;;
esac
}
_kpod_container_run() {
local options_with_args="
--add-host

View File

@ -1,24 +0,0 @@
% kpod(1) kpod-rename - Rename a container
% Ryan Cole
# kpod-images "1" "March 2017" "kpod"
## NAME
kpod rename - Rename a container
## SYNOPSIS
**kpod** **rename** CONTAINER NEW-NAME
## DESCRIPTION
Rename a container. Container may be created, running, paused, or stopped
## EXAMPLE
kpod rename redis-container webserver
kpod rename a236b9a4 mycontainer
## SEE ALSO
kpod(1)
## HISTORY
March 2017, Originally compiled by Ryan Cole <rycole@redhat.com>

View File

@ -1,38 +0,0 @@
#!/usr/bin/env bats
load helpers
IMAGE="redis:alpine"
function teardown() {
cleanup_test
}
function setup() {
copy_images
}
@test "kpod rename successful" {
skip "Test needs to be converted to kpod run"
start_crio
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE
echo "$output"
[ "$status" -eq 0 ]
run crioctl pod run --config "$TESTDATA"/sandbox_config.json
echo "$output"
pod_id="$output"
[ "$status" -eq 0 ]
run crioctl ctr create --config "$TESTDATA"/container_config.json --pod "$pod_id"
ctr_id="$output"
[ "$status" -eq 0 ]
run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rename "$ctr_id" "$NEW_NAME"
echo "$output"
[ "$status" -eq 0 ]
run bash -c ${KPOD_BINARY} $KPOD_OPTIONS inspect "$ctr_id" --format {{.Name}}
echo "$output"
[ "$status" -eq 0 ]
[ "$output" == "$NEW_NAME" ]
cleanup_ctrs
cleanup_pods
stop_crio
}

View File

@ -53,7 +53,6 @@ There are other equivalents for these tools
| `docker ps` | [`kpod ps`](./docs/kpod-ps.1.md) |
| `docker pull` | [`kpod pull`](./docs/kpod-pull.1.md) |
| `docker push` | [`kpod push`](./docs/kpod-push.1.md) |
| `docker rename` | [`kpod rename`](./docs/kpod-rename.1.md) |
| `docker rm` | [`kpod rm`](./docs/kpod-rm.1.md) |
| `docker rmi` | [`kpod rmi`](./docs/kpod-rmi.1.md) |
| `docker run` | [`kpod run`](./docs/kpod-run.1.md) |