Hab file command


#1

Hey y’all, I feel like I must be missing something. The description of the command hab file upload says:

Uploads a file to be shared between members of a Service Group

I’m a little unclear as to what kind of files these should be.

I feel as though this is probably a toml config file, if so, is there any difference between hab config apply?


#2

These can be any files your service needs to operate (secrets, ssl certs, etc.) There is a 4k ( I think ) file size limit in place currently so it’s not appropriate for larger items.


#3

that makes sense thank you!

With that in mind, is there an opposite operation for getting those files from the supervisor?


#4

No, the supervisor will always drop them off in /hab/svc/<your_svc>/files but you can’t ask the supervisor for them


#5

whoa, that hurt my head a little, but I love it!

Thanks @smacfarlane and @elliott-davis!


#6

@elliott-davis do I need to start my supervisor in a certain way?

I’m running this hab file upload from a hook within habitat.

The command hangs when I try to upload a small file.

[root@c1f10009fd99 ~]# RUST_LOG=debug hab file upload vault.default $(date +%s) /hab/svc/vault/files/vault.init
DEBUG 2018-06-21T16:25:58Z: habitat_common::ui: UI { shell: Shell { input: InputStream { isatty: true }, out: OutputStream { coloring: Auto, isatty: true, is_colored(): true, supports_color(): true }, err: OutputStream { coloring: Auto, isatty: true, is_colored(): true, supports_color(): true } } }
DEBUG 2018-06-21T16:25:58Z: hab: clap cli args: ["hab", "file", "upload", "vault.default", "1529598358", "/hab/svc/vault/files/vault.init"]
DEBUG 2018-06-21T16:25:58Z: hab: remaining cli args: []
DEBUG 2018-06-21T16:25:58Z: hab::config: No CLI config found, loading defaults
» Uploading file /hab/svc/vault/files/vault.init to 1529598358 incarnation vault.default
Ω Creating service file
DEBUG 2018-06-21T16:25:58Z: tokio::reactor: scheduling direction for: 0
DEBUG 2018-06-21T16:25:58Z: tokio::reactor: loop process - 1 events, 0.000s
DEBUG 2018-06-21T16:25:58Z: tokio::reactor: scheduling direction for: 0
DEBUG 2018-06-21T16:25:58Z: tokio::reactor: loop process - 1 events, 0.000s
↑ Applying via peer 127.0.0.1:9632
DEBUG 2018-06-21T16:25:58Z: tokio::reactor: scheduling direction for: 0

#7

There shouldn’t be any kind of special startup for this to work. Would you mind posting an issue on habitat-sh/habitat ? That is assuming @elliott-davis doesn’t know something I don’t which is entirely possible.


#8

I think an issue is the right thing here assume the file is under 4k


#9

I’m able to run this as part of the run hook, just not as part of the post-run hook. So I’ve found a work around to the problem. :slight_smile: