Commit Graph

419 Commits

Author SHA1 Message Date
Brad Fitzpatrick 8e02a79b5b osutil: add func to report whether the secret-keyring flag is loaded
Then use it in pkg/client and remove the workaround from cmd/pk-devimport.

Change-Id: Iebd380d8c021628ac5e52219d00cfdf8e03f6b7d
2017-12-20 12:53:22 -08:00
Brad Fitzpatrick 393294643b Merge "cmd/pk-devimport: command that runs a local importer" 2017-12-20 20:03:45 +00:00
mpl 99e71732b9 cmd/pk-devimport: command that runs a local importer
Change-Id: I62e35db0040cda51f2bc5ede4560974e3f3442cc
2017-12-20 17:58:56 +01:00
Paul Lindner d81b001d24 cmd/cammount: add more documentation and examples to help people get started with PerkeepFs
Fixes #789

Change-Id: I9f0d0a8a823902ed2ae1bf83d4a5b58fadac1d7d
2017-12-19 15:32:33 -08:00
Paul Lindner 15feaeb24c all: lint fixes for 'error strings should not be capitalized or end with punctuation or a newline'
Change-Id: I9c3766a51ac8be694ae76befff4b6fa9a85e34eb
2017-12-11 06:13:25 -08:00
Paul Lindner 4f4da7aa21 Remove dead code in gce.go
Change-Id: I823935eff1d8ce9f7be87bae5074b58557383877
2017-12-04 14:41:43 -08:00
Paul Lindner b09cd377d7 Switch to stdlib context from golang.org/x/net/context
This switches most usages of the pre-1.7 context library to use the
standard library.  Remaining usages are in:

  app/publisher/main.go
  pkg/fs/...

Change-Id: Ia74acc39499dcb39892342a2c9a2776537cf49f1
2017-11-26 01:12:26 -08:00
Mathieu Lonjaret 3911a41bd5 Merge "cmd/*: always output on fatal errors" 2017-10-22 15:07:06 +00:00
mpl a6a3cac0df cmd/*: always output on fatal errors
This CL addresses issues #685 and #862.

The general problem is that some critical errors, that lead clients such
as camput to exit with failure, are not displayed when not running in
verbose mode.

The reason that happens is because of code such as:

	if *cmdmain.FlagVerbose {
		log.SetOutput(cmdmain.Stderr)
	} else {
		log.SetOutput(ioutil.Discard)
	}

which means that in non-verbose mode we discard absolutely all log
messages, even those that would be printed during a Fatal* call.

To address that problem, we introduce a logger, as well as the Printf
and Logf functions using it, in pkg/cmdmain. These two functions only
output when *cmdmain.FlagVerbose is true.

Commands such as camput or camtool should now always:
1) log.SetOutput(cmdmain.Stderr) in init().
2) use log.Printf for messages that should always be printed.
3) use cmdmain.Printf/Logf for messages that should only be printed when
*cmdmain.FlagVerbose is true.
4) use log.Fatal for critical errors.
5) optionally, set the Verbose and Logger of the client(s) they are
using.

Also, camput and camtool are now relying on the global -verbose flag
from cmdmain, instead of having to define one for each subcommand.

fixes #685
fixes #862

Change-Id: I088032fd28184a201076097bf878894b22a8a120
2017-10-19 02:22:44 +02:00
Paul Lindner fa46c3935d Correct various misspelled words
Change-Id: I236e880526e4c2b0bd318da041983d557e0aa885
2017-09-11 08:33:31 -07:00
mpl 8813375592 pkg/deploy: no self-signed certs, name in camlistore.net
This CL changes the GCE launcher to work with the new features of
camlistored: i.e. that it can automatically get a hostname in
camlistore.net, and that it can get an HTTPS certificate from Let's
Encrypt, for said hostname.

In order for the user to easily (without having to look at the logs)
know what their hostname is, camlistored stores it as the
"camlistore-hostname" key in the custom metadata of the GCE instance.
The deployer can then query for that key, to report the hostname on the
instance creation success page.

Change-Id: Iaaef2d51f34fa5e1e0ee90097919abab7ee72a12
2017-01-13 16:47:04 +01:00
Brad Fitzpatrick fb21eee1e9 cmd/camtool: add sync flags to dump config and control sync concurrency
Change-Id: If94f9bc60ed6dc902a0a924801f5cfec8e787a02
2016-12-20 23:09:53 -08:00
mpl bfce01e7b2 cmd/camput: print share URL
After successfully issueing a shared blob.

Fixes #330

Change-Id: I51d4fa8434e8df471a29922bfdb5e9a7f22aec1a
2016-11-15 17:33:26 +01:00
kortschak 0fa0dfb4ef cmd/camput: update for absence of skipDirs
Change-Id: Ide6b0074a40ae738d0b60bd152fc1be0a04bb876
2016-10-10 14:57:55 +10:30
mpl 6f5a718ad1 cmd/camget: update client share chain when getting blobs from cache
When fetching shared blobs, we rely on the share chain to verify if a
blob can be reached. This chain is updated whenever we fetch an
additional link of the chain, by updating the Client.via map. However,
when some blobs of the chain are already cached in camget's DiskCache,
because we get them from the cache, we don't fetch them with
Client.FetchVia, which means the Client.via map isn't updated. And thus
the chain is broken.

This change adds Client.UpdateShareChain, and sets it as a hook to be
called by the CachingFetcher in the event of a cache hit. That way, we
ensure that the share chain is updated even when we get blobs from the
cache (instead of from the Client).

We also add a mutex to guard Client.via, because it is accessed by
concurrent smartFetch calls in case of a static-set.

As FetchVia was undocumented and not used by anyone, I made it
unexported. We can always export it again later when needed.

Fixes #856

Change-Id: I767cbec4b6f382cbccc25c0b97782b2a7472deb8
2016-09-26 19:03:04 +02:00
mpl ab06dbd80d vendor: rename google.golang.org/cloud to cloud.google.com/go
rm google.golang.org/cloud
add cloud.google.com/go at a47b182e769f5e75f5fc927ff6ee2678f7f552cf
update google.golang.org/api to 63cb68f1e3834e44683ca062ddf06cb9a889380a
update google.golang.org/grpc to
0e6ec3a4501ee9ee2d023abe92e436fd04ed4081
update go4.org to f5283521d7365fb2875408726e9cbf349f173767

fix in cmd/ pkg/ server/

TODO(mpl): fix misc/docker tools as well. next CL.

Fixes #832

Change-Id: I842b968a0afea8a5822913bd614d67cdbe50ee63
2016-09-08 15:14:12 +02:00
mpl e321eb75d5 camput: replace kv with leveldb for stat/havecache
Fixes #382

Change-Id: I9600049395c706f84f284fd7c774c3101a8eaf6d
2016-08-19 00:10:09 +02:00
Aleksandr Mogylchenko 401c44eddd Fix camget/cammount so they accept --help
Fixes #671

Change-Id: I515f592660772f25993008071c36ed46f8a54920
2016-07-15 14:39:48 +02:00
Joseph Anthony Pasquale Holsten 118585fef1 pkg/constants/google: remove, use oauth2/google instead
The google Endpoint is now available in upstream oauth2, we no longer
need to define it ourselves.

Fixes #810

Change-Id: I37db869ff7696c53ba456ecba55e72c8c86dd119
2016-06-08 16:15:39 -07:00
mpl ac4f053414 pkg/server: fix sharing, add tests
There were basically two bugs in bytesHaveSchemaLink:

-typo "blob" vs "bytes" camliType. this wouldn't happen if we used
constants from a pkg for camliTypes, instead of hardcoding them..
-returning early instead of checking all the parts of a file.

Added a test for each of those bugs. They look like they could be
refactored but they're subtly different enough that it might not be
worth it.

Context: working on issue #527

Change-Id: Ifd0bd311ae8a115de2a56994b89127db6f315a75
2016-05-11 23:58:37 +02:00
Brad Fitzpatrick db912bbb94 cmd/camtool: add basic describe --at flag
The TODO for more git-like time styles remains.

Change-Id: Iddba599644711e0cabf7bf85ee39150f25e934e6
2016-04-24 08:46:40 -07:00
Will Norris f82dc010bc cmd/camtool: output server-config.json string
In addition to outputting the JSON config needed for cloudstorage_test,
also provide the colon-delimited string needed for server-config.json.

Also update URL for Google API Console

Fixes #715

Change-Id: I3784ad3442bcf0c99cb738a3beed7b9e5fbcac68
2016-04-23 15:04:09 -07:00
Brad Fitzpatrick e93e4f3822 Fix deadlock in search/index.
The describe requests were launching a storm of RLocks which weren't
safe in the presence of goroutines trying to acquire write locks.

Instead, make the corpus locking the responsibility of the caller and
add Lock/Unlock/RLock/RUnlock methods to the index and move locking up
a level.

This also adds a fair bit of context.Context plumbing which was used
in earlier debugging.

Fixes camlistore/camlistore#709

Change-Id: I8d7254d1e1da541f8c080d62f5408aac807fd3b1
2016-04-22 14:57:10 -07:00
Brad Fitzpatrick 75d60962f6 Move remaining stuff in third_party/* to vendor/*
Change-Id: Ifbcc02817083cba68d8c1acec3e6ec50e8f61149
2016-04-20 16:49:15 -07:00
Stephen Searles f2ce28b806 camtool search: added -continue flag to complement -limit
previously, you could use the -limit flag to specify a number of desired
results. this change allows specifying the "continue" token in
subsequent commands without resorting to a raw query.

Change-Id: Ib2ec43bb228e5504fa6d6e4ee58207243f014ab1
2016-04-17 18:52:53 +00:00
Eric Drechsel e0a9699c63
Update bazil.org/fuse
move to vendor
fix (lots) of breakages due to API changes

bazil.org/fuse: 37bfa8be929171feec943f3496bc4befdeaf10db

Change-Id: Ic92faf7585371027f3c521f7a24ae56d70d18547
2016-04-09 12:40:02 -07:00
Tamás Gulácsi 7402cc0efd Delete misc unused objects
Using honnef.co/go/unused/cmd/unused

Change-Id: I672b3cb77f09e9bd80dcdc149cde4f7f2939e451
2016-04-06 17:59:51 +02:00
mpl bff04313b0 camput: use wantCapCtime
Technically, we don't need to, because we know that up.fileOpts is always
initialized when using camput file.
But we might as well be clean and consistent with the other options such
as wantVivify and wantFilePermanode.

Change-Id: I0ef157e5ade3095c42cdc288846fda8cf5db8a3c
2016-04-05 16:23:01 +02:00
Tamás Gulácsi 8d6b156a0b Misc syntax cleanup found by gosimple.
https://github.com/dominikh/go-simple

Thanks to Dominik Honnef for this great little tool!

Change-Id: I789b3a37e18f535df1ff0da47c0366ed01b2429e
2016-04-04 17:19:57 +02:00
Will Norris 77ed42edf8 add canonical import paths
The import path was added to the go file that included the package
documentation if one existed.  Otherwise, I used what seemed to be the
primary file for the package.

Fixes #689

Change-Id: If51be0e86529fd6f179e80af6781e639f8550fd2
2016-03-13 19:57:14 -07:00
mpl e0d719ba21 pkg/types: remove
Most of it replaced with vendor/go4.org/types and
vendor/go4.org/readerutil

u32 went where needed in pkg/blobserver/*
invertedBool went in pkg/types/serverconfig
atomics64 went in pkg/fs

Change-Id: I230426cda35be4b45ed67e869f14e6fdae89be22
2016-02-05 18:28:47 +01:00
Attila Tajti f0343c0fae camtool sync: local path support on Windows
Change-Id: I2d3e0c0bbd3f3ae50165d366e6a1093fceb36e5c
2016-01-11 12:00:37 +01:00
Brad Fitzpatrick 66f0ddac0e pkg/client: fix directory upload deadlock, clean up HTTP handling
Unexports pkg/client.Client.TransportForConfig in the process.

Fixes camlistore/camlistore#662

Change-Id: Ifc2d6b0fee70d5db86654897d2d377b343b6d38b
2015-12-29 23:39:29 -08:00
Brad Fitzpatrick 4086789731 pkg/httputil: also track protocol versions of HTTP response in StatsTransport 2015-12-29 13:36:50 -08:00
Brad Fitzpatrick fba8b457de pkg/client: wire up http2 support, unexported Client.InsecureTLS
Also add a flag to camtool discovery:

$ camtool discovery -httpversion
HTTP/2.0

Fixes camlistore/camlistore#661

Change-Id: I6db392e01bd176a2757ebdb4a0e881eebaec9b03
2015-12-29 11:33:38 -08:00
Brad Fitzpatrick 5a2fe47b73 cmd/camdeploy: fix build, embed a client ID/secret, accept region or zone
Much easier to use now.
2015-12-28 15:15:11 -08:00
Mathieu Lonjaret 09a6ca6ef5 Merge "vendor: move pkg/images dependencies from third_party" 2015-12-18 21:17:12 +00:00
mpl 6af01f6c71 vendor: move pkg/images dependencies from third_party
This change is in anticipation of moving pkg/images to go4.org, where it
should not depend on packages in third_party.

So:
third_party/github.com/nf/cr2 -> vendor/github.com/nf/cr2
third_party/github.com/rwcarlsen/goexif -> vendor/github.com/rwcarlsen/goexif
third_party/golang.org/x/image/tiff -> vendor/golang.org/x/image/tiff

Note that third_party/go/pkg/image/jpeg was also a dependency of
pkg/images. We had vendored image/jpeg from tip at the time because it
offered advantages over the version from Go1.3
(https://github.com/camlistore/camlistore/issues/463).
Since we now depend on Go1.5, we can go back to depend on the stdlib
version, so we simply remove third_party/go/pkg/image/jpeg and adjust
the imports accordingly.

Change-Id: Ifc8ffae0551102e644a0a0c67f3ff89e04df15c7
2015-12-18 22:15:33 +01:00
mpl 96d06ac2bd camget: fix flag conflicts
The conflict was introduced in cea5e332ce
by linking pkg/cmdmain in, which introduced its public flags.

Change-Id: I6374c2fb1657f6fd534c1342a5947ef6db16a3e2
2015-12-18 17:08:03 +01:00
mpl cea5e332ce vendor: go4.org/legal
At rev c3c16077b235db4c6b2a2a6121c2d429707f4ed4

And use it in new package pkg/camlegal

And remove pkg/legal

Change-Id: I5e398aa5f145a02a04d33719276fd2f8b82ab12b
2015-12-16 18:50:49 +01:00
Tamás Gulácsi 9f7e1df32b Remove pkg/context
Use golang.org/x/net/context instead.

Fixes #648.

Change-Id: I676a2f25458be97610a49d6f954f2102cbd373fa
2015-12-12 23:09:02 +01:00
mpl 1ffd5895e0 camtool/googinit: use cloud/storage Client instead of googlestorage
Issue #652

Change-Id: I54b2041acfa8f998e1fb082c54f6c7069615d8a7
2015-12-08 00:11:42 +01:00
mpl 40be4d8da2 vendor: go4.org/jsonconfig (and errorutil)
Previously pkg/jsonconfig and pkg/errorutil

Copied from go4.org at rev d1b8a2fb2de6160036e4801aa5e4d855571078b8

Change-Id: I673ed55b0825baa2607289b6082f205100261d7a
2015-12-01 17:21:49 +01:00
mpl 3dbaa49395 vendor: go4.org/oauthutil
Previously pkg/oauthutil

Imported from go4.org at rev
3970dd22c0e7e2397304ad626a20b72f8db41b58

Change-Id: Iffb751d03af9bc0c3008e5cd3833ed42fba0bdb1
2015-11-27 00:31:40 +01:00
mpl 12eddf9c19 vendor: go4.org/strutil go4.org/syncutil
They were internal packages (under pkg), which we are now moving to
go4.org, so we in turn need to vendor them in now.

Change-Id: I92224f731404d0bd4ca1c57492bed37cb3367ed4
2015-11-21 00:21:20 +01:00
mpl 6dfe405666 camput init: get client config from server help handler
This is particularly useful for getting clients fully configured for a
server on the same host.

Context:
https://github.com/scaleway-community/scaleway-camlistore/issues/2

Change-Id: I667dd32a80cba4e1e6f6a4ca86a0497a72047d30
2015-09-28 16:44:38 +02:00
Brad Fitzpatrick 6f58fc2426 Fix build, move more stuff from third_party to vendor. 2015-08-18 10:19:49 +02:00
Tamás Gulácsi 533433f163 cmd/camtool reindex-diskpacked: don't panic on high-level conf
If no metaIndex is specified, just go on, but don't panic.
Also try to clear the logic a little bit (don't overwrite indexConf).

Change-Id: I43e61ac3d5cd239cc113cb034ff3dd61eaaa14fd
2015-07-23 07:16:14 +02:00
Brad Fitzpatrick d6cb8d1c21 cmd/camput: fix typo in help description
Change-Id: Idfc07aff1a2b95009b1d42d962e08a96952f8977
2015-05-17 15:28:40 -07:00
mpl 750cc42bfe Merge "camput: add -contents_only flag" 2015-04-21 14:20:14 +00:00