Swift TempAuth returned 404 when HEAD the account - openstack-swift

I am a newbie to Swift, but was trying to install it on my CentOS 6.5 VM. I have done
Installing lasted Swift release (1.12.0) and python-swiftclient (2.0.2) and their dependencies
Preparing and mounting my drive (a separated device formated as xfs) at /svr/node/d1
Creating the rings and adding the device to the rings (account, container, object)
Building the rings, which generates one .ring.gz file for each ring. Placed them in /etc/swift
Configuring hash_path_prefix for proxy
Setting up TempAuth and adding a new user 'myaccount:me' with password 'pa'
Starting proxy and account.
I would expect to successfully do
swift -A http://localhost:8080/auth/v1.0 -U myaccount:me -K pa stat
but the command told me 'Account not found'. To see detailed information, I did
swift --debug -v -A http://localhost:8080/auth/v1.0 -U myaccount:me -K pa stat
the output is
INFO:requests.packages.urllib3.connectionpool:Starting new HTTP connection (1): localhost
DEBUG:requests.packages.urllib3.connectionpool:"GET /auth/v1.0 HTTP/1.1" 200 0
DEBUG:swiftclient:REQ: curl -i http://localhost:8080/auth/v1.0 -X GET
DEBUG:swiftclient:RESP STATUS: 200 OK
DEBUG:swiftclient:RESP HEADERS: [('content-length', '0'), ('x-trans-id', 'tx88b6b6b71ec14c3393248-00530de039'), ('x-auth-token', 'AUTH_tkdc7e842046e9469da324f2ec82c80a92'), ('x-storage-token', 'AUTH_tkdc7e842046e9469da324f2ec82c80a92'), ('date', 'Wed, 26 Feb 2014 12:38:17 GMT'), ('x-storage-url', 'http://localhost:8080/v1/AUTH_myaccount'), ('content-type', 'text/html; charset=UTF-8')]
INFO:requests.packages.urllib3.connectionpool:Starting new HTTP connection (1): localhost
DEBUG:requests.packages.urllib3.connectionpool:"HEAD /v1/AUTH_myaccount HTTP/1.1" 404 0
INFO:swiftclient:REQ: curl -i http://localhost:8080/v1/AUTH_myaccount -I -H "X-Auth-Token: AUTH_tkdc7e842046e9469da324f2ec82c80a92"
INFO:swiftclient:RESP STATUS: 404 Not Found
INFO:swiftclient:RESP HEADERS: [('date', 'Wed, 26 Feb 2014 12:38:17 GMT'), ('content-length', '0'), ('content-type', 'text/html; charset=UTF-8'), ('x-trans-id', 'tx553c40e63c69470e9d146-00530de039')]
ERROR:swiftclient:Account HEAD failed: http://localhost:8080:8080/v1/AUTH_myaccount 404 Not Found
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/swiftclient/client.py", line 1192, in _retry
rv = func(self.url, self.token, *args, **kwargs)
File "/usr/lib/python2.6/site-packages/swiftclient/client.py", line 469, in head_account
http_response_content=body)
ClientException: Account HEAD failed: http://localhost:8080:8080/v1/AUTH_myaccount 404 Not Found
Account not found

I figured out my self: in proxy-server.conf, add these two lines
allow_account_management = true
account_autocreate = true

Related

Why wget is getting just an empty folder?

I am trying to mirror a site index similar to
https://index.gd.workers.dev/
using wget. I run this code
wget -e robots=off --content-on-error --mirror -np -R "index.html*" https://index.gd.workers.dev/
It's giving this output:
--2020-03-11 01:20:05-- http://index.gd.workers.dev/ Resolving index.gd.workers.dev (index.gd.workers.dev)... 104.31.87.133,
104.31.86.133, 2606:4700:3035::681f:5785, ... Connecting to index.gd.workers.dev (index.gd.workers.dev)|104.31.87.133|:80...
connected. HTTP request sent, awaiting response... 200 OK Length: 361
[text/html] Saving to: ‘index.gd.workers.dev/index.html.tmp’
index.gd.workers.de 100%[===================>] 361 --.-KB/s in
0s
Last-modified header missing -- time-stamps turned off. 2020-03-11
01:20:05 (2.1 MB/s) - ‘index.gd.workers.dev/index.html.tmp’ saved
[361/361]
Removing index.gd.workers.dev/index.html.tmp since it should be
rejected.
FINISHED --2020-03-11 01:20:05-- Total wall clock time: 0.1s
Downloaded: 1 files, 361 in 0s (2.1 MB/s)
The end result is just a folder with the site name and nothing inside it. What am I doing wrong here? and is there any other way to mirror the directory?

Httpie hangs in Git Bash terminal on Windows 10

According to the official documentation httpie tool also works on Windows 10, however when I run the command in terminal it simply hangs and nothing happens:
$ http :8000/
Is there an explanation what is going on and preferably a workaround?
I was able to get a hint by appending the --debug parameter:
$ http localhost:8000 --debug
HTTPie 0.9.9
Requests 2.12.4
Pygments 2.1.3
Python 3.4.4 (v3.4.4:737efcadf5a6, Dec 20 2015, 20:20:57) [MSC v.1600 64 bit (AMD64)]
c:\users\...\venv\scripts\python.exe
Windows 10
<Environment {
"colors": 256,
"config": {
"__meta__": {
"about": "HTTPie configuration file",
"help": "https://httpie.org/docs#config",
"httpie": "0.9.9"
},
"default_options": "[]"
},
"config_dir": "C:\\Users\\...\\AppData\\Roaming\\\\httpie",
"is_windows": true,
"stderr": "<colorama.ansitowin32.StreamWrapper object at 0x0000000003CDAB00>",
"stderr_isatty": false,
"stdin": "<_io.TextIOWrapper name='<stdin>' mode='r' encoding='cp1252'>",
"stdin_encoding": "cp1252",
"stdin_isatty": false,
"stdout": "<colorama.ansitowin32.StreamWrapper object at 0x0000000003CDA9B0>",
"stdout_encoding": "cp1252",
"stdout_isatty": false
}>
The crucial point is that the isatty related option is set to false.
I was able to resole it and getting http working as expected by prepending the winpty command:
$ winpty http :8000
HTTP/1.0 200 OK
Content-Type: application/json
Date: Fri, 16 Dec 2016 19:56:58 GMT
Server: WSGIServer/0.2 CPython/3.4.4
X-Frame-Options: SAMEORIGIN
{
"status": "ok"
}
Solution:
By adding this alias line
alias http='winpty http'
to the ~/.profile file, one can use the initial command http as expected with git bash.

Why gcloud command is slow to start?

Just typing gcloud for help take 5 secs.
$ gcloud
...
gcloud 0.30s user 0.13s system 7% cpu 5.508 total
$ gcloud version
Google Cloud SDK 128.0.0
alpha 2016.01.12
bq 2.0.24
bq-nix 2.0.24
core 2016.09.23
core-nix 2016.09.20
gcloud
gsutil 4.21
gsutil-nix 4.21
kubectl
kubectl-darwin-x86_64 1.3.7
$ uname -a
Darwin hiroshi-MacBook.local 16.0.0 Darwin Kernel Version 16.0.0: Mon Aug 29 17:56:20 PDT 2016; root:xnu-3789.1.32~3/RELEASE_X86_64 x86_64
EDIT 2017-03-31: Zachary said that gcloud 148.0.0 addressed this issue. So try gcloud components update. see https://stackoverflow.com/users/4922212/zachary-newman
tl;dr
It turns out that socket.gethostbyaddr(socket.gethostname()) is slow for .local hostname in macOS.
$ python -i
>>> socket.gethostname()
'hiroshi-MacBook.local'
>>> socket.gethostbyaddr(socket.gethostname()) # it takes about 5 seconds
('localhost', ['1.0.0.127.in-addr.arpa'], ['127.0.0.1'])
So, for a workaround, just added the hostname to the localhost line of /etc/hosts.
127.0.0.1 localhost hiroshi-Macbook.local
After that is return value is different, but it returns in an instant.
>>> socket.gethostbyaddr(socket.gethostname())
('localhost', ['1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa'], ['::1'])
How do I get there
Where gcloud command is:
$ which gcloud
/Users/hiroshi/google-cloud-sdk/bin/gcloud
Edit the endline of the shell script...
...
+ echo "$CLOUDSDK_PYTHON" $CLOUDSDK_PYTHON_ARGS "${CLOUDSDK_ROOT_DIR}/lib/gcloud.py" "$#"
"$CLOUDSDK_PYTHON" $CLOUDSDK_PYTHON_ARGS "${CLOUDSDK_ROOT_DIR}/lib/gcloud.py" "$#"
to echo where the gcloud.py is:
$ gcloud
python2.7 -S /Users/hiroshi/google-cloud-sdk/lib/gcloud.py
OK. Who take the 5 secs?
$ python2.7 -S -m cProfile -s time /Users/hiroshi/google-cloud-sdk/lib/gcloud.py
173315 function calls (168167 primitive calls) in 5.451 seconds
Ordered by: internal time
ncalls tottime percall cumtime percall filename:lineno(function)
1 5.062 5.062 5.062 5.062 {_socket.gethostbyaddr}
...
_socket.gethostbyaddr is.
What is the argument of the function call and backtrace look like?
I added some lines before main() of gcloud.py
import traceback
def mygethostbyaddr(addr):
print addr
traceback.print_stack()
return addr
import socket
socket.gethostbyaddr = mygethostbyaddr
Execute gcloud again.
I got it is my .local name of my machine.
$ gcloud
hiroshi-MacBook.local
File "/Users/hiroshi/google-cloud-sdk/lib/gcloud.py", line 74, in <module>
main()
File "/Users/hiroshi/google-cloud-sdk/lib/gcloud.py", line 70, in main
sys.exit(googlecloudsdk.gcloud_main.main())
File "/Users/hiroshi/google-cloud-sdk/lib/googlecloudsdk/gcloud_main.py", line 121, in main
metrics.Started(START_TIME)
File "/Users/hiroshi/google-cloud-sdk/lib/googlecloudsdk/core/metrics.py", line 411, in Wrapper
return func(*args, **kwds)
File "/Users/hiroshi/google-cloud-sdk/lib/googlecloudsdk/core/metrics.py", line 554, in Started
collector = _MetricsCollector.GetCollector()
File "/Users/hiroshi/google-cloud-sdk/lib/googlecloudsdk/core/metrics.py", line 139, in GetCollector
_MetricsCollector._instance = _MetricsCollector()
File "/Users/hiroshi/google-cloud-sdk/lib/googlecloudsdk/core/metrics.py", line 197, in __init__
hostname = socket.getfqdn()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 141, in getfqdn
hostname, aliases, ipaddrs = gethostbyaddr(name)
File "/Users/hiroshi/google-cloud-sdk/lib/gcloud.py", line 32, in mygethostbyaddr
traceback.print_stack()
#hiroshi's answer solved the issue for me i.e. to run gcloud components update. However, since I had installed gcloud through their Cloud SDK using a package manager, I was stuck with the following error*:
ERROR: (gcloud.components.update) You cannot perform this action
because the Google Cloud CLI component manager is disabled for this
installation.
Hence, I had to explicitly mention the apt-get libraries to perform the update. The following command helped me to get it done in one go:
sudo apt-get update && sudo apt-get --only-upgrade install google-cloud-sdk-app-engine-go google-cloud-sdk-datastore-emulator google-cloud-sdk-datalab google-cloud-sdk-firestore-emulator google-cloud-sdk-kubectl-oidc google-cloud-sdk google-cloud-sdk-app-engine-python-extras google-cloud-sdk-cloud-build-local kubectl google-cloud-sdk-cbt google-cloud-sdk-minikube google-cloud-sdk-skaffold google-cloud-sdk-cloud-run-proxy google-cloud-sdk-pubsub-emulator google-cloud-sdk-config-connector google-cloud-sdk-gke-gcloud-auth-plugin google-cloud-sdk-kpt google-cloud-sdk-local-extract google-cloud-sdk-nomos google-cloud-sdk-app-engine-grpc google-cloud-sdk-bigtable-emulator google-cloud-sdk-app-engine-python google-cloud-sdk-terraform-validator google-cloud-sdk-anthos-auth google-cloud-sdk-spanner-emulator google-cloud-sdk-app-engine-java
*More details as to why the aforementioned error occurs and how to permanently solve it can be found here.

Post review request of committed files in CVS to Review Board

I am trying to post review request of files i committed in CVS, currently i have two file with their revisions. I have tried almost all possible combinations mentioned # https://www.reviewboard.org/docs/rbtools/0.7/rbt/commands/post/#posting-paths
but none of them worked. Samples are below:
rbt post -d src/com/sibisoft/northstar/acc/ap/reports/ApReportUtil.java##1.1.4.27.4.2.12.8.2.3.4.1.4.1:src/com/sibisoft/northstar/acc/ap/reports/ApReportUtil.java##1.1.4.27.4.2.12.8.2.3.4.1.4.2 ui/Accounting/AP/Reports/rptCheckReconciliation.jsp##1.1.4.6.32.1.34.1:ui/Accounting/AP/Reports/rptCheckReconciliation.jsp##1.1.4.6.32.1.34.1.2.1
rbt post -d src/com/sibisoft/northstar/acc/ap/reports/ApReportUtil.java#1.1.4.27.4.2.12.8.2.3.4.1.4.1,#1.1.4.27.4.2.12.8.2.3.4.1.4.2 ui/Accounting/AP/Reports/rptCheckReconciliation.jsp#1.1.4.6.32.1.34.1,#1.1.4.6.32.1.34.1.2.1
rbt post -d -I src/com/sibisoft/northstar/acc/ap/reports/ApReportUtil.java##1.1.4.27.4.2.12.8.2.3.4.1.4.1,##1.1.4.27.4.2.12.8.2.3.4.1.4.2 -I ui/Accounting/AP/Reports/rptCheckReconciliation.jsp##1.1.4.6.32.1.34.1,##1.1.4.6.32.1.34.1.2.1
rbt post -d src/com/sibisoft/northstar/acc/ap/reports/ApReportUtil.java##1.1.4.27.4.2.12.8.2.3.4.1.4.1 src/com/sibisoft/northstar/acc/ap/reports/ApReportUtil.java##1.1.4.27.4.2.12.8.2.3.4.1.4.2 ui/Accounting/AP/Reports/rptCheckReconciliation.jsp##1.1.4.6.32.1.34.1 ui/Accounting/AP/Reports/rptCheckReconciliation.jsp##1.1.4.6.32.1.34.1.2.1
rbt post -d src/com/sibisoft/northstar/acc/ap/reports/ApReportUtil.java##1.1.4.27.4.2.12.8.2.3.4.1.4.1,##1.1.4.27.4.2.12.8.2.3.4.1.4.2 ui/Accounting/AP/Reports/rptCheckReconciliation.jsp##1.1.4.6.32.1.34.1,##1.1.4.6.32.1.34.1.2.1
I am getting either
rbtools.clients.errors.TooManyRevisionsError: Too many revisions specified
error or
rbtools.commands.CommandError: Error validating diff
The specified diff file is empty. (HTTP 400, API Error 219)
I have 2 files, their traces are below:
/home/cvs/src/ns/src/com/sibisoft/northstar/acc/ap/reports/Attic/ApReportUtil.java,v <-- src/com/sibisoft/northstar/acc/ap/reports/ApReportUtil.java
new revision: 1.1.4.27.4.2.12.8.2.3.4.1.4.2; previous revision: 1.1.4.27.4.2.12.8.2.3.4.1.4.1
/home/cvs/src/ns/ui/Accounting/AP/Reports/Attic/rptCheckReconciliation.jsp,v <-- ui/Accounting/AP/Reports/rptCheckReconciliation.jsp
new revision: 1.1.4.6.32.1.34.1.2.1; previous revision: 1.1.4.6.32.1.34.1
Any help would be really appreciated.
UPDATE:
#unreturnedURL: I tried but getting following error.
D:\IntelliJ_workspace\52B7>rbt post -d -I src/com/sibisoft/northstar/acc/ap/reports/ApReportUtil.java##1.1.4.27.4.2.12.8.2.3.4.1.4.1:src/com/sibisoft/northstar/acc/ap/reports/ApReportUtil.java##1.1.4.27.4.2.12.8.2.3.4.1.4.2
>>> RBTools 0.7.5 alpha 0 (dev)
>>> Python 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)]
>>> Running on Windows-8-6.2.9200
>>> Home = C:\Users\Waqar Ali Khan\AppData\Roaming
>>> Current directory = D:\IntelliJ_workspace\52B7
>>> Checking for a Subversion repository...
>>> Unable to execute "svn help": skipping SVN
>>> Checking for a Git repository...
>>> Running: git rev-parse --git-dir
>>> Command exited with rc 128: ['git', 'rev-parse', '--git-dir']
fatal: Not a git repository (or any of the parent directories): .git
---
>>> Checking for a Mercurial repository...
>>> Unable to execute "hg --help": skipping Mercurial
>>> Checking for a CVS repository...
>>> repository info: Path: CVS-SERVER:/home/cvs/src, Base path: None, Supports changesets: False
>>> Making HTTP GET request to http://example.com/api/
>>> Running: cvs diff -uN src/com/sibisoft/northstar/acc/ap/reports/ApReportUtil.java##1.1.4.27.4.2.12.8.2.3.4.1.4.1:src/com/sibisoft/northstar/acc/ap/reports/ApReportUtil.java##1.1.4.27.4.2.12.8.2.3.4.1.4.2
>>> Command exited with rc 1: ['cvs', 'diff', '-uN', 'src/com/sibisoft/northstar/acc/ap/reports/ApReportUtil.java##1.1.4.27.4.2.12.8.2.3.4.1.4.1:src/com/sibisoft/northstar/acc/ap/reports/ApReportUtil.java##1.1.4.27.4.2.12.8.2.3.4.1.4.2']
>>> Making HTTP GET request to http://example.com/api/validation/diffs/
>>> Cached response for HTTP GET http://example.com/api/validation/diffs/ expired and was modified
>>> Making HTTP POST request to http://example.com/api/validation/diffs/
>>> Got API Error 219 (HTTP code 400): The specified diff file is empty.
>>> Error data: {u'stat': u'fail', u'err': {u'msg': u'The specified diff file is empty.', u'code': 219}}
Traceback (most recent call last):
File "C:\Program Files (x86)\RBTools\bin\..\Python27\Scripts\rbt-script.py", line 8, in <module>
load_entry_point('RBTools==0.7.5alpha0', 'console_scripts', 'rbt')()
File "C:\Program Files (x86)\RBTools\Python27\lib\site-packages\rbtools-0.7.5alpha0-py2.7.egg\rbtools\commands\main.py", line 133, in main
command.run_from_argv([RB_MAIN, command_name] + args)
File "C:\Program Files (x86)\RBTools\Python27\lib\site-packages\rbtools-0.7.5alpha0-py2.7.egg\rbtools\commands\__init__.py", line 622, in run_from_argv
exit_code = self.main(*args) or 0
File "C:\Program Files (x86)\RBTools\Python27\lib\site-packages\rbtools-0.7.5alpha0-py2.7.egg\rbtools\commands\post.py", line 754, in main
(msg_prefix, e))
rbtools.commands.CommandError: Error validating diff
The specified diff file is empty. (HTTP 400, API Error 219)
The link you mentioned is for posting diff for uncommited code for Perforce. Instead try this: https://www.reviewboard.org/docs/rbtools/0.7/rbt/commands/post/#posting-committed-code.
Try posting for a single file with -I option e.g.
rbt post -d -I src/com/sibisoft/northstar/acc/ap/reports/ApReportUtil.java##1.1.4.27.4.2.12.8.2.3.4.1.4.1:src/com/sibisoft/northstar/acc/ap/reports/ApReportUtil.java##1.1.4.27.4.2.12.8.2.3.4.1.4.2
If it does not work, pls post the complete debug log. If it works, try for both files with -I before each revision range.

How do I get a refresh token for command line gsutil to work?

I use gsutil to transfer files from a Windows machine to Google Cloud Storage.
I have not used it for more than 6 months and now when I try it I get:
Failure: invalid_grant
From researching this I suspect the access token is no longer valid as it has not been used for 6 months, and I need a refresh token?
I cannot seem to find how to get and use this.
thanks
Running gsutil -DD config produces the following output:
C:\Python27>python c:/gsutil/gsutil -DD config
DEBUG:boto:path=/pub/gsutil.tar.gz
DEBUG:boto:auth_path=/pub/gsutil.tar.gz
DEBUG:boto:Method: HEAD
DEBUG:boto:Path: /pub/gsutil.tar.gz
DEBUG:boto:Data:
DEBUG:boto:Headers: {}
DEBUG:boto:Host: storage.googleapis.com
DEBUG:boto:Params: {}
DEBUG:boto:establishing HTTPS connection: host=storage.googleapis.com, kwargs={'timeout': 70}
DEBUG:boto:Token: None
DEBUG:oauth2_client:GetAccessToken: checking cache for key *******************************
DEBUG:oauth2_client:FileSystemTokenCache.GetToken: key=******************************* not present (cache_file= c:\users\admini~1\appdata\local\temp\2\oauth2_client-tokencache._.ea******************************)
DEBUG:oauth2_client:GetAccessToken: token from cache: None
DEBUG:oauth2_client:GetAccessToken: fetching fresh access token...
INFO:oauth2client.client:Refreshing access_token connect: (accounts.google.com, 443)
send: 'POST /o/oauth2/token HTTP/1.1\r\nHost: accounts.google.com\r\nContent-Length: 177\r\ncontent-type: application/x- www-form-urlencoded\r\naccept-encoding: gzip, deflate\r\nuser-agent: Python-httplib2/0.7.7 (gzip)\r\n\r\nclient_secret=******************&grant_type=refresh_token&refresh_token=****************************************&client_ id=****************.apps.googleusercontent.com' reply: 'HTTP/1.1 400 Bad Request\r\n'
header: Content-Type: application/json; charset=utf-8 header: Cache-Control: no-cache, no-store, max-age=0, must-revalidate header: Pragma: no-cache header: Expires: Fri, 01 Jan 1990 00:00:00 GMT header: Date: Thu, 08 May 2014 02:02:21 GMT header: Content-Disposition: attachment; filename="json.txt"; filename*=UTF-8''json.txt header: Content-Encoding: gzip header: X-Content-Type-Options: nosniff header: X-Frame-Options: SAMEORIGIN
header: X-XSS-Protection: 1; mode=block header: Server: GSE header: Alternate-Protocol: 443:quic header: Transfer-Encoding: chunked
INFO:oauth2client.client:Failed to retrieve access token: { "error" : "invalid_grant" }
Traceback (most recent call last):
File "c:/gsutil/gsutil", line 83, in <module> gslib.__main__.main() File "c:\gsutil\gslib_main_.py", line 151, in main command_runner.RunNamedCommand('ver', ['-l'])
File "c:\gsutil\gslib\command_runner.py", line 95, in RunNamedCommand self._MaybeCheckForAndOfferSoftwareUpdate(command_name, debug)):
File "c:\gsutil\gslib\command_runner.py", line 181, in _MaybeCheckForAndOfferSoftwareUpdate cur_ver = LookUpGsutilVersion(suri_builder.StorageUri(GSUTIL_PUB_TARBALL))
File "c:\gsutil\gslib\util.py", line 299, in LookUpGsutilVersion obj = uri.get_key(False)
File "c:\gsutil\third_party\boto\boto\storage_uri.py", line 342, in get_key generation=self.generation)
File "c:\gsutil\third_party\boto\boto\gs\bucket.py", line 102, in get_key query_args_l=query_args_l)
File "c:\gsutil\third_party\boto\boto\s3\bucket.py", line 176, in _get_key_internal query_args=query_args)
File "c:\gsutil\third_party\boto\boto\s3\connection.py", line 547, in make_request retry_handler=retry_handler
File "c:\gsutil\third_party\boto\boto\connection.py", line 947, in make_request retry_handler=retry_handler)
File "c:\gsutil\third_party\boto\boto\connection.py", line 838, in _mexe request.authorize(connection=self)
File "c:\gsutil\third_party\boto\boto\connection.py", line 377, in authorize connection._auth_handler.add_auth(self, *********)
File "c:\gsutil\gslib\third_party\oauth2_plugin\oauth2_plugin.py", line 22, in add_auth self.oauth2_client.GetAuthorizationHeader()
File "c:\gsutil\gslib\third_party\oauth2_plugin\oauth2_client.py", line 338, in GetAuthorizationHeader return 'Bearer %s' % self.GetAccessToken().token
File "c:\gsutil\gslib\third_party\oauth2_plugin\oauth2_client.py", line 309, in GetAccessToken access_token = self.FetchAccessToken()
File "c:\gsutil\gslib\third_party\oauth2_plugin\oauth2_client.py", line 435, in FetchAccessToken credentials.refresh(http)
File "c:\gsutil\third_party\google-api-python-client\oauth2client\client.py", line 516, in refresh self._refresh(http.request)
File "c:\gsutil\third_party\google-api-python-client\oauth2client\client.py", line 653, in _refresh self._do_refresh_request(http_request)
File "c:\gsutil\third_party\google-api-python-client\oauth2client\client.py", line 710, in _do_refresh_request raise AccessTokenRefreshError(error_msg) oauth2client.client.AccessTokenRefreshError: invalid_grant
You can ask gsutil to configure itself. Go to the directory with gsutil and run this:
c:\gsutil> python gsutil config
Gsutil will lead you through the steps to setting up your credentials.
That said, access tokens only normally last about a half hour. It's more likely that the previously-configured refresh token was revoked for some reason. Alternately, you can only request new tokens at a certain rate. It's possible your account has been requesting many, many refresh tokens for some reason and has been temporarily rate limited by the access service.
The command to authenticate is now
$ gcloud auth login
That should refresh your grant and get you going again.
You may also want to run
$ gcloud components update
to update your installation.
Brandon Yarbrough gave me suggestions which solved this problem. He suspected that the .boto file was corrupted and suggested I delete it and run gsutil config again. I did this and it solved the problem.