File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,13 +2,12 @@ package main
22
33import (
44 "fmt"
5- "os"
6- "strconv"
7-
85 "github.com/deis/deisctl/client"
96 "github.com/deis/deisctl/cmd"
107 "github.com/deis/deisctl/updatectl"
118 docopt "github.com/docopt/docopt-go"
9+ "os"
10+ "strconv"
1211)
1312
1413func exit (err error , code int ) {
@@ -20,12 +19,12 @@ func Update(args []string) {
2019
2120 if len (args ) != 4 {
2221 fmt .Println ("unsufficient args" )
23- fmt .Println ("usage: updatectl update instance deis" )
22+ fmt .Println ("usage: deisctl update instance deis" )
2423 return
2524 }
2625 if args [2 ] != "instance" && args [3 ] != "deis" {
2726 fmt .Println ("wrong args " )
28- fmt .Println ("usage: updatectl update instance deis" )
27+ fmt .Println ("usage: deisctl update instance deis" )
2928 return
3029 }
3130 Args := []string {
@@ -34,8 +33,8 @@ func Update(args []string) {
3433 "--clients-per-app=1" ,
3534 "--min-sleep=5" ,
3635 "--max-sleep=10" ,
37- "--app-id=329cd607-06fe-4bde-8ecd-613b58c6945f" ,
38- "--group-id=bee2027e-29a4-4135-bffb-b2864234dd15" ,
36+ "--app-id=" + os . Getenv ( "DEIS_APP_ID" ) ,
37+ "--group-id=" + os . Getenv ( "DEIS_GROUP_ID" ) ,
3938 "--version=1.1.0" ,
4039 }
4140 updatectl .Update (Args )
Original file line number Diff line number Diff line change @@ -69,6 +69,14 @@ func GetMachineID(root string) string {
6969 return strings .TrimSpace (string (id ))
7070}
7171
72+ func GetVersion () string {
73+ id , err := ioutil .ReadFile ("/home/core/deis/systemd/version" )
74+ if err != nil {
75+ return ""
76+ }
77+ return strings .TrimSpace (string (id ))
78+ }
79+
7280// GetFileBytes returns a byte array of the contents of a file.
7381func GetFileBytes (filename string ) []byte {
7482 file , _ := os .Open (filename )
@@ -104,14 +112,15 @@ func Chdir(app string) error {
104112}
105113
106114func Extract (file , dir string ) {
115+ var wd , _ = os .Getwd ()
107116 Chdir (dir )
108117 cmdl := exec .Command ("tar" , "-xvf" , file )
109118 if _ , _ , err := RunCommandWithStdoutStderr (cmdl ); err != nil {
110119 fmt .Printf ("Failed:\n %v" , err )
111120 } else {
112121 fmt .Println ("ok" )
113122 }
114- Chdir ("/home/core/" )
123+ Chdir (wd )
115124}
116125
117126// Rmdir removes a directory and its contents.
You can’t perform that action at this time.
0 commit comments