format Unix
This commit is contained in:
@@ -1,41 +1,41 @@
|
||||
package tool
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
log "oc-deploy/log_wrapper"
|
||||
"oc-deploy/utils"
|
||||
"oc-deploy/kubectl"
|
||||
)
|
||||
|
||||
type KubecltInstallData struct {
|
||||
obj ToolData
|
||||
}
|
||||
|
||||
func (this KubecltInstallData) Get() (ToolData) {
|
||||
return this.obj
|
||||
}
|
||||
|
||||
func (this KubecltInstallData) Download() (error) {
|
||||
|
||||
bin_dir := this.obj.Bin
|
||||
bin := filepath.Join(bin_dir, this.obj.Name)
|
||||
url := fmt.Sprintf(this.obj.Url, this.obj.Version)
|
||||
|
||||
log.Log().Debug().Msg(fmt.Sprintf("Téléchargement : %s, %s", bin, url))
|
||||
os.MkdirAll(bin_dir, os.ModePerm)
|
||||
|
||||
err := utils.DownloadFromUrl(bin, url, 0777)
|
||||
if err != nil {return err}
|
||||
|
||||
os.Chmod(bin, 0755)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
///////////////
|
||||
func (this KubecltInstallData) Version(path string) (string, error) {
|
||||
return kubectl.Version(path)
|
||||
}
|
||||
package tool
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
log "oc-deploy/log_wrapper"
|
||||
"oc-deploy/utils"
|
||||
"oc-deploy/kubectl"
|
||||
)
|
||||
|
||||
type KubecltInstallData struct {
|
||||
obj ToolData
|
||||
}
|
||||
|
||||
func (this KubecltInstallData) Get() (ToolData) {
|
||||
return this.obj
|
||||
}
|
||||
|
||||
func (this KubecltInstallData) Download() (error) {
|
||||
|
||||
bin_dir := this.obj.Bin
|
||||
bin := filepath.Join(bin_dir, this.obj.Name)
|
||||
url := fmt.Sprintf(this.obj.Url, this.obj.Version)
|
||||
|
||||
log.Log().Debug().Msg(fmt.Sprintf("Téléchargement : %s, %s", bin, url))
|
||||
os.MkdirAll(bin_dir, os.ModePerm)
|
||||
|
||||
err := utils.DownloadFromUrl(bin, url, 0777)
|
||||
if err != nil {return err}
|
||||
|
||||
os.Chmod(bin, 0755)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
///////////////
|
||||
func (this KubecltInstallData) Version(path string) (string, error) {
|
||||
return kubectl.Version(path)
|
||||
}
|
||||
|
Reference in New Issue
Block a user