diff --git a/tools/git2pantheon/git_uploader.go b/tools/git2pantheon/git_uploader.go index 5cbf3650b..38ac8c60a 100644 --- a/tools/git2pantheon/git_uploader.go +++ b/tools/git2pantheon/git_uploader.go @@ -55,9 +55,10 @@ func push2Pantheon(directory string) { log.Print("Found pantheon2.yml in the root of the repo, uploading.") var user = os.Getenv("UPLOADER_USER") var password = os.Getenv("UPLOADER_PASSWORD") - args := []string{"pantheon.py", "push", "--user", user, "--password", password, "--directory", directory} - if user == "" || password == "" { - log.Print("Credentials not found, using uploader's default credentials.") + var server = os.Getenv("PANTHEON_SERVER") + args := []string{"pantheon.py", "push", "--user", user, "--password", password, "--directory", directory, "--server", server} + if user == "" || password == "" || server == "" { + log.Print("Environment variables not found, using uploader and pantheon.yml settings.") args = []string{"pantheon.py", "push", "--directory", directory} } //Now call python diff --git a/tools/git2pantheon/git_uploader_test.go b/tools/git2pantheon/git_uploader_test.go index 5c36cd10e..f99fb10f0 100644 --- a/tools/git2pantheon/git_uploader_test.go +++ b/tools/git2pantheon/git_uploader_test.go @@ -74,8 +74,8 @@ func TestPush2PantheonWithYML(t *testing.T) { if strings.Contains(output, "pantheon2.yml was not found in the root of the repo, skipping upload.") { t.Errorf("No pantheon2.yml was found, and no upload attempted.") } - if !strings.Contains(output, "Credentials not found") { - t.Errorf("ENV UPLOADER_PASSWORD and UPLOADER_USER should always be not set during build.") + if !strings.Contains(output, "Environment variables not found") { + t.Errorf("ENV PANTHEON_SERVER, UPLOADER_PASSWORD and UPLOADER_USER should always be not set during build.") } cleanup(uploader) cleanup(yml) diff --git a/uploader/pantheon.py b/uploader/pantheon.py index 8e368a6aa..0c000a63f 100755 --- a/uploader/pantheon.py +++ b/uploader/pantheon.py @@ -12,6 +12,7 @@ import yaml DEFAULT_SERVER = 'http://localhost:8080' +# This check needs to be removed when we start forcing a REPOSITORY name. if 'PANTHEON_SERVER' in os.environ: DEFAULT_REPOSITORY = 'gitImport' else: @@ -308,10 +309,7 @@ def processRegexMatches(files, globs, filetype): files.remove(f) -if 'PANTHEON_SERVER' in os.environ: - server = os.environ['PANTHEON_SERVER'] -else: - server = resolveOption(args.server, 'server', DEFAULT_SERVER) +server = resolveOption(args.server, 'server', DEFAULT_SERVER) repository = resolveOption(args.repository, 'repository', DEFAULT_REPOSITORY) mode = 'sandbox' if args.sandbox else 'repository'