mirror of
https://github.com/rancher/os.git
synced 2025-09-03 15:54:24 +00:00
add an example service using EXTRA_CMDLINE
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
This commit is contained in:
@@ -31,6 +31,20 @@ kernel ${base-url}/vmlinuz rancher.state.dev=LABEL=RANCHER_STATE rancher.state.a
|
|||||||
|
|
||||||
The hidden part of the command line can be accessed with either `sudo ros config get rancher.environment.EXTRA_CMDLINE`, or by using a service file's environment array.
|
The hidden part of the command line can be accessed with either `sudo ros config get rancher.environment.EXTRA_CMDLINE`, or by using a service file's environment array.
|
||||||
|
|
||||||
|
An example service.yml file:
|
||||||
|
|
||||||
|
```
|
||||||
|
test:
|
||||||
|
image: alpine
|
||||||
|
command: echo "tell me a secret ${EXTRA_CMDLINE}"
|
||||||
|
labels:
|
||||||
|
io.rancher.os.scope: system
|
||||||
|
environment:
|
||||||
|
- EXTRA_CMDLINE
|
||||||
|
```
|
||||||
|
|
||||||
|
When this service is run, the `EXTRA_CMDLINE` will be set.
|
||||||
|
|
||||||
|
|
||||||
### cloud-init Datasources
|
### cloud-init Datasources
|
||||||
|
|
||||||
|
@@ -36,4 +36,23 @@ func (s *QemuSuite) TestElideCmdLine(c *C) {
|
|||||||
)
|
)
|
||||||
|
|
||||||
// And then add a service.yml file example.
|
// And then add a service.yml file example.
|
||||||
|
s.CheckCall(c,
|
||||||
|
`echo 'test:
|
||||||
|
image: alpine
|
||||||
|
command: echo "tell me a secret ${EXTRA_CMDLINE}"
|
||||||
|
labels:
|
||||||
|
io.rancher.os.scope: system
|
||||||
|
environment:
|
||||||
|
- EXTRA_CMDLINE
|
||||||
|
' > test.yml`)
|
||||||
|
s.CheckCall(c, "sudo mv test.yml /var/lib/rancher/conf/test.yml")
|
||||||
|
s.CheckCall(c, "sudo ros service enable /var/lib/rancher/conf/test.yml")
|
||||||
|
s.CheckCall(c, "sudo ros service up test")
|
||||||
|
s.CheckOutput(c,
|
||||||
|
"test_1 | tell me a secret /init cc.hostname=nope rancher.password=three\n",
|
||||||
|
Equals,
|
||||||
|
"sudo ros service logs test | grep secret",
|
||||||
|
)
|
||||||
|
|
||||||
|
// TODO: add a test showing we have the right password set
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user