102 Commits

Author SHA1 Message Date
David Anderson
ee0987169f pixiecore/cli: implement logging controls.
The v1compat CLI is now complete, with support for --debug. The v2 CLI
additionally supports optional timestamping, so that when you're using
a modern init system that captures logs for you (e.g. systemd), you
don't have stuttering timestamps.
2016-08-15 21:54:47 -07:00
David Anderson
a943caa093 pixiecore/cli: add missing file with logging functions. 2016-08-15 21:38:39 -07:00
David Anderson
39b02f723b tftp: move the "Listening on" log message to only show when using ListenAndServe. 2016-08-15 21:34:33 -07:00
David Anderson
4aa8885728 pixiecore: rework logging to provide less verbose, more useful logs by default.
Also adds a debug channel with the full line noise.
2016-08-15 21:33:57 -07:00
David Anderson
63a0c5fb32 pixiecore/cli: make CLI() consistently os.Exit() when done. 2016-08-15 18:34:21 -07:00
David Anderson
04527f7dfd pixiecore: lock import paths to go.universe.tf. 2016-08-15 00:58:15 -07:00
David Anderson
e17cabd818 dhcp4: correct the package documentation to match convention. 2016-08-15 00:46:45 -07:00
David Anderson
8293616a81 pixiecore/api-example: unexport the HTTP handler function. 2016-08-15 00:46:11 -07:00
David Anderson
2fe08ecbf6 pixiecore: add tests for the HTTP serving (notably ipxe script construction). 2016-08-15 00:41:25 -07:00
David Anderson
d3cf17aa06 pixiecore: unit test booters, and fix bugs found by tests. 2016-08-15 00:02:10 -07:00
David Anderson
16aa5cf353 pixiecore: properly quote the ID parameter in StaticBooter. 2016-08-14 22:36:30 -07:00
David Anderson
81a8cca451 pixiecore: refactor APIBooter commandline construction.
This allows API servers to return URL(x) in the cmdline template,
which pixiecore translates to an appropriate ID(x) template call
to get the file proxied via Pixiecore.
2016-08-14 22:28:39 -07:00
David Anderson
f904f42035 pixiecore: factor out URL signing/decoding, and unit test it. 2016-08-14 21:46:12 -07:00
David Anderson
4941f47975 pixiecore: switch Spec.Cmdline from a map to a templated string.
The main difficulty in passing a commandline as a plain string is
that you sometimes want to encode IDs into it, to tell your kernel
to fetch something via Pixiecore. Solving that problem with maps is
a bit clunky. Instead, now we use a text/template {{ ID "foo" }} to
mean "make a URL that, when fetched, reads the file "foo" from the
Booter.
2016-08-14 21:22:17 -07:00
David Anderson
edb7ad89bb pixiecore/cli: plumb other flags to API mode in v1compat. 2016-08-14 19:48:39 -07:00
David Anderson
71a7b89493 pixiecore/cli: support API mode in v1compat. 2016-08-14 19:47:14 -07:00
David Anderson
7bbdbc7df1 pixiecore: implement API mode, and plumb it into the CLI. 2016-08-14 19:44:34 -07:00
David Anderson
c3fe975c1e Switch .travis.yml to using Travis's VM infrastructure.
My request to whitelist the install of atftp seems to be lost in issue tracker
limbo, as are all other whitelisting requests for the last few months.
2016-08-14 18:33:20 -07:00
David Anderson
2fc6bdac12 Fix the golint command in .travis.yml, to actually lint stuff. 2016-08-14 18:15:37 -07:00
David Anderson
2639514bac Correct .travis.yml to be further glide-ed. 2016-08-14 17:57:57 -07:00
David Anderson
fed7f78f53 Glide-ify .travis.yml to test everything against the glided dependencies. 2016-08-14 17:54:50 -07:00
David Anderson
0407e90330 Add glide.yaml and glide.lock for vendoring.
I'm deliberately *not* checking in the vendor/ directory here, because
doing so would interfere with people trying to use the libraries rather
than the binaries. Sadly, none of the vendoring tools work very well when
I ask them to vendorize just cmd/ (they reimport a copy of the libs in
this repository), so for simplicity right now I'll lock the versions with
glide, but users wanting reproducible builds will still need to
`glide install` themselves.
2016-08-14 17:49:01 -07:00
David Anderson
09a8c3d87d pixiecore/cli: fix CLI's docstring. 2016-08-14 16:59:51 -07:00
David Anderson
2a7824bf67 .gitignore: ignore pixiecore-apache2. 2016-08-14 16:58:04 -07:00
David Anderson
0e92c2bebe pixiecore/cli: add secret debug command to dump builtin ipxe binaries.
The overall debug command is hidden from the CLI, since it should only
be useful when developing.
2016-08-14 16:57:02 -07:00
David Anderson
ff7a0b56c6 pixiecore: Add a retry loop in the iPXE boot.
iPXE has an annoying race condition where it sometimes doesn't notice
the ProxyDHCP response when booting, and fails. So we embed a boot
script in the builtin iPXE binaries that implements the retry loop
recommended in the documentation. Empirically, this has resolved
flaky boots on my test machine, usually no more than a single
retry is needed.
2016-08-14 16:55:27 -07:00
David Anderson
b5e956b9fc pixiecore/cli: implement v1 compatibility for the CLI.
This hack tries to interpret the commandline based on what Pixiecore v1
did, before handing off to the fancier v2 CLI logic.

Doesn't support API mode yet, since that's not yet implemented in
the library.
2016-08-14 16:54:06 -07:00
David Anderson
36351cddec pixiecore/cli: add flags for passing ipxe binaries at runtime.
These flags are both for providing binaries when running the apache2
version of pixiecore (which doesn't have builtin ipxe), and for
overriding the builtin version if desired.
2016-08-12 00:54:59 -07:00
David Anderson
62e2f4bee3 pixiecore/cli: pass Ipxe firmwares as a package global.
The cli package is meant for single-shot execution anyway, so
instead of plumbing everything through reentrantly, let's just
have a global you can seed before calling CLI().
2016-08-11 23:49:18 -07:00
David Anderson
b43c25904b pixiecore: implement the boot command, using static booter.
Doesn't quite work yet: cmdline isn't processed very well, and the
ipxe firmwares aren't plumbed through.
2016-08-11 23:29:46 -07:00
David Anderson
7ffbdcadd2 pixiecore: Implement a static booter for simple boot cases. 2016-08-11 23:09:50 -07:00
David Anderson
3e1664bb17 pixiecore: add missing file.
The build was broken for a while. Doh.
2016-08-10 22:28:20 -07:00
David Anderson
81efc36c64 pixiecore: Refactor the CLI logic into its own subpackage.
The two binaries (Apache2 and GPL) both invoke the cli package to do
the work, the only difference between them is that the GPL binary passes
it embedded ipxe binaries.
2016-08-10 22:27:09 -07:00
David Anderson
4d9f88efd8 cmd: make the GPLv2 pixiecore own the unadorned "pixiecore" binary name.
In practice, most people will want the standalone binary that Just
Works, the variant that doesn't embed ipxe is going to be for niche
applications only.
2016-08-10 21:57:19 -07:00
David Anderson
6a88cefc9b pixiecore: factor the ipxe script generation out of the HTTP handler.
This makes it easier to test the script generation in isolation,
as well as making the whole thing easier to follow.
2016-08-10 21:54:16 -07:00
David Anderson
6766b5ca59 dhcp4: make it required for Conn.RecvDHCP to return interface information.
As it turns out, it's fairly difficult to do anything useful with DHCP
without this information, and the Conn implementations I can think of
all provide the information, so we might as well make it a requirement.
2016-08-10 21:39:05 -07:00
David Anderson
2b4d1e8101 pixiecore: replace fmt.Print* with a user-customizable logging function.
Also introduces a "Trace" member to the API, for the future addition of
extremely verbose and complete tracing, to be used for bug reports. But
for now, only Log is used.
2016-08-10 21:36:47 -07:00
David Anderson
0fbd8039c4 Fix URLs in README.md to point to the right packages. 2016-08-10 00:03:02 -07:00
David Anderson
e67e7bea68 Turn README.md into a directory of the repository. 2016-08-09 00:40:24 -07:00
David Anderson
c3052f317f pixiecore: copy READMEs over.
The documentation doesn't match the current code at all, but it's
the target to aim for.
2016-08-09 00:32:45 -07:00
David Anderson
9619a5ab87 pixiecore-gpl: Add README.md explaining the licensing silliness. 2016-08-09 00:28:29 -07:00
David Anderson
b26e36a301 Add .gitignore to ignore the various binaries produced while hacking. 2016-08-09 00:21:49 -07:00
David Anderson
e440f01741 pixiecore: new version of Pixiecore, using netboot libraries.
This version is still *extremely* barebones, and the unstable tag
in the README applies triple for it, but the code in its current
state is capable of booting x86 and UEFI clients correctly, and
that was hard enough to merit a snapshot checkpoint.
2016-08-09 00:19:08 -07:00
David Anderson
bff529103e third_party: update ipxe. 2016-08-09 00:16:25 -07:00
David Anderson
d0f6cb0348 dhcp4: Fix handling of the boot filename. 2016-08-08 20:45:57 -07:00
David Anderson
551e4aee91 Support the tsize extension for TFTP.
It turns out many PXE firmwares request tsize to size the download
buffer, and will refuse to download at all if the server cannot
provide a tsize.

This unfortunately breaks API compatibility to add a size parameter,
but I think it's an unfortunate necessity to make this work.
2016-08-08 20:41:12 -07:00
David Anderson
879aab828e dhcp4: correct the default address for linuxConn.
net.ListenPacket wants an actual IP address, whereas ":67" gives you a nil.
2016-07-17 01:59:10 -07:00
David Anderson
c9ec51e475 dhcp4: fix portable Conn initialization and packet transmission.
Conn is supposed to accept "" to mean "listen for DHCP on all interfaces",
but portableConn didn't correctly handle that.

And I got the comparison wrong on ifidx in the portable send function, so
packets got sent out entirely the wrong interface :(.
2016-07-16 22:22:42 -07:00
David Anderson
684f93040b third_party: import ipxe for embedding into Go. 2016-07-16 17:11:22 -07:00
David Anderson
cbb14a347d Document the canonical import path in the README. 2016-06-18 16:45:45 -07:00