Merge pull request #1302 in YUNIONIO/onecloud from ~WANYAOQI/onecloud:bugfix/wyq/minor-fix-0321 to release/2.6.0

* commit 'a004e163a4edc7ad92787657818ed956d8427f63':
  fix deploy file
This commit is contained in:
邱剑
2019-03-22 15:47:22 +08:00
4 changed files with 10 additions and 3 deletions
+1 -1
View File
@@ -4,7 +4,7 @@ import "net"
type SSHConfig struct {
Username string `json:"username,omitempty"`
RemoteIP string `json:"ip"`
RemoteIP string `json:"remote_ip"`
Password string `json:"password"`
}
+5 -2
View File
@@ -32,19 +32,22 @@ func (d *sGuestRootFsDriver) DeployFiles(deploys []jsonutils.JSONObject) error {
}
sPath, err := deploy.GetString("path")
if err != nil {
log.Errorln(err)
return err
}
dirname := filepath.Dir(sPath)
if !d.GetPartition().Exists(sPath, caseInsensitive) {
if !d.GetPartition().Exists(dirname, caseInsensitive) {
modeRWXOwner := syscall.S_IRUSR | syscall.S_IWUSR | syscall.S_IXUSR
err := d.GetPartition().Mkdir(dirname, modeRWXOwner, caseInsensitive)
if err != nil {
log.Errorln(err)
return err
}
}
if content, err := deploy.GetString("content"); err != nil {
if content, err := deploy.GetString("content"); err == nil {
err := d.GetPartition().FilePutContents(sPath, content, modAppend, caseInsensitive)
if err != nil {
log.Errorln(err)
return err
}
}
+1
View File
@@ -69,6 +69,7 @@ func (p *SKVMGuestDiskPartition) Mount() bool {
func (p *SKVMGuestDiskPartition) mount(readonly bool) error {
if _, err := procutils.NewCommand("mkdir", "-p", p.mountPath).Run(); err != nil {
log.Errorln(err)
return err
}
var cmds = []string{"mount", "-t"}
+3
View File
@@ -28,6 +28,9 @@ func (f *SLocalGuestFS) SupportSerialPorts() bool {
}
func (f *SLocalGuestFS) GetLocalPath(sPath string, caseInsensitive bool) string {
if sPath == "." {
sPath = ""
}
var fullPath = f.mountPath
pathSegs := strings.Split(sPath, "/")
for _, seg := range pathSegs {