(cmd *cobra.Command, args []string)
| 642 | } |
| 643 | |
| 644 | func runStorageDownloadOCI(cmd *cobra.Command, args []string) error { |
| 645 | ctx := context.Background() |
| 646 | nodeName := args[0] |
| 647 | storageName := args[1] |
| 648 | reference := args[2] |
| 649 | |
| 650 | session, err := initCLISession(cmd) |
| 651 | if err != nil { |
| 652 | return printError(err) |
| 653 | } |
| 654 | |
| 655 | if session == nil { |
| 656 | return nil |
| 657 | } |
| 658 | |
| 659 | client, err := session.clientForNode(ctx, nodeName) |
| 660 | if err != nil { |
| 661 | return printError(err) |
| 662 | } |
| 663 | |
| 664 | upid, err := client.PullStorageOCIImage(nodeName, storageName, api.StorageOCIPullOptions{ |
| 665 | Reference: reference, |
| 666 | }) |
| 667 | if err != nil { |
| 668 | return printError(fmt.Errorf("failed to pull OCI image: %w", err)) |
| 669 | } |
| 670 | |
| 671 | out := storageTaskOutput{ |
| 672 | Node: nodeName, |
| 673 | Storage: storageName, |
| 674 | Reference: reference, |
| 675 | UPID: upid, |
| 676 | Status: "running", |
| 677 | } |
| 678 | |
| 679 | if getNoWait(cmd) { |
| 680 | return printJSON(out) |
| 681 | } |
| 682 | |
| 683 | exitStatus, waitErr := waitForTask(ctx, client, nodeName, upid, "pull OCI image") |
| 684 | out.Status = "complete" |
| 685 | out.ExitStatus = exitStatus |
| 686 | |
| 687 | if err := printJSON(out); err != nil { |
| 688 | return err |
| 689 | } |
| 690 | |
| 691 | if waitErr != nil { |
| 692 | return waitErr |
| 693 | } |
| 694 | |
| 695 | return nil |
| 696 | } |
| 697 | |
| 698 | // ── storage restore ─────────────────────────────────────────────────────────── |
| 699 |
nothing calls this directly
no test coverage detected