GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(cli): require project definition for destroy · getstackhead/stackhead@f7d86c0

This repository was archived by the owner on Feb 26, 2024. It is now read-only.

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • ansible/__tests__/steps
    • destroy.sh
  • cli/commands
    • deploy.go
    • destroy.go
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎ansible/__tests__/steps/destroy.sh‎

Copy file name to clipboardExpand all lines: ansible/__tests__/steps/destroy.sh
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# IMPORTANT: This must run after test_deploy.sh!
66

77
if [[ $INPUT_CLI != '' ]]; then
8-
${INPUT_CLI_BIN_PATH} destroy container "${INPUT_IPADDRESS}" -c "/tmp/.stackhead-cli.yml"
8+
${INPUT_CLI_BIN_PATH} destroy "${GITHUB_ACTION_PATH}/ansible/__tests__/projects/container.yml" "${INPUT_IPADDRESS}" -c "/tmp/.stackhead-cli.yml"
99
else
1010
INVENTORY_PATH="${GITHUB_ACTION_PATH}/ansible/__tests__/inventory.yml"
1111
TEST=1 ansible-playbook "${GITHUB_ACTION_PATH}/ansible/playbooks/application-destroy.yml" -i "${INVENTORY_PATH}" --extra-vars "project_name=container" -vv
Collapse file

‎cli/commands/deploy.go‎

Copy file name to clipboardExpand all lines: cli/commands/deploy.go
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
// DeployApplication is a command object for Cobra that provides the deploy command
1515
var DeployApplication = &cobra.Command{
1616
Use: "deploy [path to project definition] [ipv4 address]",
17-
Example: "deploy ./my_project_definition.yml 192.168.178.14",
17+
Example: "deploy ./my_project.yml 192.168.178.14",
1818
Short: "Deploy a project onto the target server",
1919
Long: `deploy will deploy the given project onto the server`,
2020
Args: cobra.ExactArgs(2),
Collapse file

‎cli/commands/destroy.go‎

Copy file name to clipboardExpand all lines: cli/commands/destroy.go
+7-3Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ package commands
33
import (
44
"fmt"
55
"os"
6+
"path/filepath"
7+
"strings"
68
"sync"
79

810
"github.com/spf13/cobra"
@@ -13,8 +15,8 @@ import (
1315

1416
// DestroyApplication is a command object for Cobra that provides the destroy command
1517
var DestroyApplication = &cobra.Command{
16-
Use: "destroy [project name] [ipv4 address]",
17-
Example: "destroy my_project_name 192.168.178.14",
18+
Use: "destroy [path to project definition] [ipv4 address]",
19+
Example: "destroy ./my_project.yml 192.168.178.14",
1820
Short: "Destroy a deployed project on a target server",
1921
Long: `destroy will tear down the given project that has been deployed onto the server`,
2022
Args: cobra.ExactArgs(2),
@@ -27,11 +29,13 @@ var DestroyApplication = &cobra.Command{
2729
// Generate Inventory file
2830
inventoryFile, err := ansible.CreateInventoryFile(
2931
ansible.IPAddress(args[1]),
32+
ansible.ProjectDefinitionFile(args[0]),
3033
)
34+
3135
if err == nil {
3236
defer os.Remove(inventoryFile)
3337
options := make(map[string]string)
34-
options["project_name"] = args[0]
38+
options["project_name"] = strings.TrimSuffix(strings.TrimSuffix(filepath.Base(args[0]), ".yml"), ".yaml")
3539
err = routines.ExecAnsiblePlaybook("application-destroy", inventoryFile, options)
3640
}
3741

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.