mirror of
https://github.com/rancher/os.git
synced 2025-07-05 19:16:13 +00:00
Additional mounts can be set in cloud config
This commit is contained in:
parent
a002939a3f
commit
f24facc06c
@ -26,6 +26,7 @@ import (
|
||||
"time"
|
||||
|
||||
yaml "github.com/cloudfoundry-incubator/candiedyaml"
|
||||
"github.com/docker/docker/pkg/mount"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/coreos/coreos-cloudinit/config"
|
||||
@ -216,6 +217,15 @@ func executeCloudConfig() error {
|
||||
}
|
||||
}
|
||||
|
||||
for _, configMount := range cc.Mounts {
|
||||
if len(configMount) != 4 {
|
||||
log.Errorf("Unable to mount %s: must specify exactly four arguments", configMount[1])
|
||||
}
|
||||
if err := mount.Mount(configMount[0], configMount[1], configMount[2], configMount[3]); err != nil {
|
||||
log.Errorf("Unable to mount %s: %s", configMount[1], err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ type CloudConfig struct {
|
||||
SSHAuthorizedKeys []string `yaml:"ssh_authorized_keys"`
|
||||
WriteFiles []config.File `yaml:"write_files"`
|
||||
Hostname string `yaml:"hostname"`
|
||||
|
||||
Mounts [][]string `yaml:"mounts,omitempty"`
|
||||
Rancher RancherConfig `yaml:"rancher,omitempty"`
|
||||
}
|
||||
|
||||
|
9
tests/integration/assets/test_16/cloud-config.yml
Normal file
9
tests/integration/assets/test_16/cloud-config.yml
Normal file
@ -0,0 +1,9 @@
|
||||
#cloud-config
|
||||
write_files:
|
||||
- path: /test
|
||||
content: test
|
||||
- path: /home/rancher/test
|
||||
mounts:
|
||||
- ["/test", "/home/rancher/test", "", "bind"]
|
||||
ssh_authorized_keys:
|
||||
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC85w9stZyiLQp/DkVO6fqwiShYcj1ClKdtCqgHtf+PLpJkFReSFu8y21y+ev09gsSMRRrjF7yt0pUHV6zncQhVeqsZtgc5WbELY2DOYUGmRn/CCvPbXovoBrQjSorqlBmpuPwsStYLr92Xn+VVsMNSUIegHY22DphGbDKG85vrKB8HxUxGIDxFBds/uE8FhSy+xsoyT/jUZDK6pgq2HnGl6D81ViIlKecpOpWlW3B+fea99ADNyZNVvDzbHE5pcI3VRw8u59WmpWOUgT6qacNVACl8GqpBvQk8sw7O/X9DSZHCKafeD9G5k+GYbAUz92fKWrx/lOXfUXPS3+c8dRIF
|
17
tests/integration/rostest/test_16_cloud_config_mounts.py
Normal file
17
tests/integration/rostest/test_16_cloud_config_mounts.py
Normal file
@ -0,0 +1,17 @@
|
||||
import pytest
|
||||
import rostest.util as u
|
||||
from rostest.util import SSH
|
||||
|
||||
|
||||
cloud_config_path = './tests/integration/assets/test_16/cloud-config.yml'
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def qemu(request):
|
||||
q = u.run_qemu(request, run_args=['--cloud-config', cloud_config_path])
|
||||
u.flush_out(q.stdout)
|
||||
return q
|
||||
|
||||
|
||||
def test_cloud_config_mounts(qemu):
|
||||
SSH(qemu).check_call('cat /home/rancher/test | grep test')
|
Loading…
Reference in New Issue
Block a user