Mikhail Korobov avatar Mikhail Korobov committed ce3e415

DB_ROOT_PASSWORD handling is fixed

Comments (0)

Files changed (1)


         to = base_dir + name
     config_template = _config_template_path(name)
-    if config_template is None and skip_unexistent:
-        return
-    elif config_template is None:
-        operations._handle_failure('Config template "%s" not found' % name)
+    if config_template is None:
+        if skip_unexistent:
+            return
+        operations._handle_failure('Config template "%s" is not found' % name)
     files.upload_template(config_template, to, env.conf, use_jinja=True,
     env.conf = getattr(env, 'conf', {})
     env.conf.setdefault('INSTANCE_NAME', user)
     env.conf.setdefault('PROJECT_PATH', '')
-    if env.conf.get('DB_USER') == 'root':
-        env.conf.setdefault('DB_ROOT_PASSWORD', env.conf.get('DB_PASSWORD'))
     HOME_DIR = '/home/%s' % user
     SRC_DIR = posixpath.join(HOME_DIR, 'src', env.conf['INSTANCE_NAME'])
     env.conf = defaults
+    if env.conf.DB_USER == 'root':
+        if 'DB_ROOT_PASSWORD' in env.conf and 'DB_PASSWORD' in env.conf:
+            msg = "DB_ROOT_PASSWORD and DB_PASSWORD must be the same because DB_USER is root"
+            assert env.conf.DB_ROOT_PASSWORD == env.conf.DB_PASSWORD, msg
+        else:
+            # auto-fill the missing option
+            password = env.conf.get('DB_ROOT_PASSWORD', env.conf.DB_PASSWORD)
+            env.conf.DB_PASSWORD = env.conf.DB_ROOT_PASSWORD = password
     for vcs in ['git', 'hg', 'none']: # expand VCS name to full import path
         if env.conf.VCS == vcs:
             env.conf.VCS = 'fab_deploy.vcs.' + vcs
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.