Skip to content

Commit

Permalink
First halting steps to removing import-db directory [skip ci] [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
rfay committed Mar 1, 2019
1 parent e7c0133 commit c805e4a
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 38 deletions.
2 changes: 0 additions & 2 deletions pkg/ddevapp/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,6 @@ func (app *DdevApp) ReadConfig() error {
app.OmitContainers = globalconfig.DdevGlobalConfig.OmitContainers
}

app.ImportDir = app.GetConfigPath("import-db")

app.SetApptypeSettingsPaths()

return nil
Expand Down
34 changes: 1 addition & 33 deletions pkg/ddevapp/ddevapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ type DdevApp struct {
Platform string `yaml:"-"`
Provider string `yaml:"provider,omitempty"`
DataDir string `yaml:"-"`
ImportDir string `yaml:"-"`
SiteSettingsPath string `yaml:"-"`
SiteLocalSettingsPath string `yaml:"-"`
providerInstance Provider `yaml:"-"`
Expand Down Expand Up @@ -263,13 +262,13 @@ func (app *DdevApp) GetWebserverType() string {
func (app *DdevApp) ImportDB(imPath string, extPath string, progress bool) error {
app.DockerEnv()
var extPathPrompt bool
dbPath := app.ImportDir

err := app.ProcessHooks("pre-import-db")
if err != nil {
return err
}

err = os.MkdirAll(app.ImportDir, 0777)
err = fileutil.PurgeDirectory(dbPath)
if err != nil {
return fmt.Errorf("failed to cleanup %s before import: %v", dbPath, err)
Expand Down Expand Up @@ -696,11 +695,6 @@ func (app *DdevApp) Start() error {
return err
}

err = app.prepSiteDirs()
if err != nil {
return err
}

err = app.AddHostsEntries()
if err != nil {
return err
Expand Down Expand Up @@ -933,7 +927,6 @@ func (app *DdevApp) DockerEnv() {
"DDEV_BGSYNCIMAGE": app.BgsyncImage,
"DDEV_APPROOT": app.AppRoot,
"DDEV_DOCROOT": app.Docroot,
"DDEV_IMPORTDIR": app.ImportDir,
"DDEV_URL": app.GetHTTPURL(),
"DDEV_HOSTNAME": app.HostName(),
"DDEV_UID": uidStr,
Expand Down Expand Up @@ -1367,31 +1360,6 @@ func (app *DdevApp) RemoveHostsEntries() error {
return nil
}

// prepSiteDirs creates a site's directories for db container mounts
func (app *DdevApp) prepSiteDirs() error {

dirs := []string{
app.ImportDir,
}

for _, dir := range dirs {
fileInfo, err := os.Stat(dir)

if os.IsNotExist(err) { // If it doesn't exist, create it.
err = os.MkdirAll(dir, os.FileMode(int(0774)))
if err != nil {
return fmt.Errorf("Failed to create directory %s, err: %v", dir, err)
}
} else if err == nil && fileInfo.IsDir() { // If the directory exists, we're fine and don't have to create it.
continue
} else { // But otherwise it must have existed as a file, so bail
return fmt.Errorf("error trying to create directory %s, err: %v", dir, err)
}
}

return nil
}

// GetActiveAppRoot returns the fully rooted directory of the active app, or an error
func GetActiveAppRoot(siteName string) (string, error) {
var siteDir string
Expand Down
3 changes: 0 additions & 3 deletions pkg/ddevapp/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ services:
target: "/var/lib/mysql"
volume:
nocopy: true
- type: "bind"
source: "${DDEV_IMPORTDIR}"
target: "/db"
- type: "bind"
source: "."
target: "/mnt/ddev_config"
Expand Down

0 comments on commit c805e4a

Please sign in to comment.