question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

create_config command should sanity check if prereqs (gcloud auth) is done

See original GitHub issue

I 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:open
  • Created 5 years ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
inferno-chromiumcommented, Mar 8, 2019

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 ?

1reaction
inferno-chromiumcommented, Mar 8, 2019

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Diff - external/google-cache-invalidation-api/src - Google Git
This file is an integral part of the build system for your - application and should be checked into Version Control Systems.
Read more >
Diff - ansible-collection-community-kubernetes - Gitiles
+ +You can run the collection's test suites with the commands: + + make test-sanity + make test-integration + +### Testing with `molecule`...
Read more >
Apropos sta - FreeBSD
This can be done using a bitfield which would allow for checking for multiple features at once; SPI_cursor_open(3): set up a cursor using...
Read more >
DEVASC Flashcards - Quizlet
Study with Quizlet and memorize flashcards containing terms like REPL, Significant Whitespaces Rules, What command in the python interpreter display the ...
Read more >
release_notes.txt - Ubuntu Cloud Images
Please see the full changelogs for a complete listing of changes: ... script file robust against su authentication failures and missing LVM commands....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found