create_config command should sanity check if prereqs (gcloud auth) is done
See original GitHub issueI almost followed the instructions to setup a production instance, but put my client secrets in the config dir as that seemed logical.
python butler.py create_config --oauth-client-secrets-path=$CLIENT_SECRETS_PATH --project-id=$CLOUD_PROJECT_ID $CONFIG_DIR
runs for a while, and creates the default
and cron-service
services, displaying their info on the console.
It then moves on to:
Running: python butler.py run setup --config-dir /home/mmacnair/clusterfuzz-config/ --non-dry-run
which after several minutes of no output eventually fails with this backtrace:
| Traceback (most recent call last):
| File "butler.py", line 282, in <module>
| main()
| File "butler.py", line 256, in main
| command.execute(args)
| File "src/local/butler/run.py", line 41, in execute
| script.execute(args)
| File "src/local/butler/scripts/setup.py", line 268, in execute
| setup_config(args.non_dry_run)
| File "src/local/butler/scripts/setup.py", line 200, in setup_config
| config = data_types.Config.query().get()
| File "/home/mmacnair/clusterfuzz/src/python/datastore/ndb_patcher.py", line 144, in get
| return _retry_wrap(result_func)()
| File "/home/mmacnair/clusterfuzz/src/third_party/google/api_core/retry.py", line 270, in retry_wrapped_func
| on_error=on_error,
| File "/home/mmacnair/clusterfuzz/src/third_party/google/api_core/retry.py", line 179, in retry_target
| return target()
| File "/home/mmacnair/clusterfuzz/src/python/datastore/ndb_patcher.py", line 143, in <lambda>
| result_func = lambda: next(self.iter(limit=1), None)
| File "/home/mmacnair/clusterfuzz/src/python/datastore/ndb_patcher.py", line 162, in iter
| self, projection=projection, keys_only=keys_only)
| File "/home/mmacnair/clusterfuzz/src/python/datastore/ndb_patcher.py", line 399, in _ndb_query_to_cloud_queries
| subqueries.append(_client().query(
| File "/home/mmacnair/clusterfuzz/src/python/datastore/ndb_patcher.py", line 201, in _client
| init()
| File "/home/mmacnair/clusterfuzz/src/python/datastore/ndb_patcher.py", line 418, in init
| creds = credentials.get_default()[0]
| File "/home/mmacnair/clusterfuzz/src/python/base/retry.py", line 88, in _wrapper
| result = func(*args, **kwargs)
| File "/home/mmacnair/clusterfuzz/src/python/google_cloud_utils/credentials.py", line 52, in get_default
| return google.auth.default(scopes=scopes)
| File "/home/mmacnair/clusterfuzz/src/third_party/google/auth/_default.py", line 317, in default
| raise exceptions.DefaultCredentialsError(_HELP_MESSAGE)
| google.auth.exceptions.DefaultCredentialsError: Could not automatically determine credentials. Please set GOOGLE_APPLICATION_CREDENTIALS or explicitly create credentials and re-run the application. For more information, please see https://cloud.google.com/docs/authentication/getting-started
| Return code is non-zero (1).
| Exit.
Traceback (most recent call last):
File "butler.py", line 282, in <module>
main()
File "butler.py", line 256, in main
command.execute(args)
File "src/local/butler/create_config.py", line 267, in execute
gcloud, args.new_config_dir, appengine_region=args.appengine_region)
File "src/local/butler/create_config.py", line 195, in deploy_appengine
'--prod', '--config-dir', config_dir
File "/usr/lib/python2.7/subprocess.py", line 190, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['python', 'butler.py', 'deploy', '--force', '--targets', 'appengine', '--prod', '--config-dir', '/home/mmacnair/clusterfuzz-config/']' returned non-zero exit status 1
Looking in my config dir, the client secrets json file has vanished. I assume this is the problem?
In the instructions, perhaps add a note that the credentials can’t be placed in the config dir, as they will be erased?
I’ve tried to recover from this by re-running create_config
both after restoring the client credentials file and with the file in a different location, but it fails with the same error as above.
I tried running python butler.py deploy --config-dir=$CONFIG_DIR --prod --force
but it fails with a missing bucket - presumably because the setup didn’t complete.
Any suggestions? I see the SDK is variously looking for environment variables, cloud SDK credentials, and gae credentials. Which of these does butler normally set up, and is there a way I can manually configure them?
Issue Analytics
- State:
- Created 5 years ago
- Comments:8
Top GitHub Comments
first command can maybe tested with “gcloud auth application-default print-access-token”, but unsure on how to verify “gcloud auth login” has been run (+cc @oliverchang). I agree with you that we can add some sanity checking in create_config command, patches welcome. otherwise, we will get to this sometime or just add another line in docs before create_config is run to remind people ?
Can you do https://google.github.io/clusterfuzz/getting-started/prerequisites/#optional-log-in-to-your-google-cloud-account just to make your auth is correctly setup.
“Looking in my config dir, the client secrets json file has vanished. I assume this is the problem?” - yes that is the issue. download the creds json again to somewhere NOT config dir, reset $CLIENT_SECRETS_PATH to this location and then re-run create_config, let it finish. verify that prod deployment succeeded.