Compare commits
13 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
a9e8940132 | ||
|
cf194ab85e | ||
|
e8c8b811fe | ||
|
f5ecc05d62 | ||
|
66a2f00679 | ||
|
14cad6f7c3 | ||
|
6f188bd5d4 | ||
|
41832ab19e | ||
|
672e4c07af | ||
|
be53013431 | ||
|
c30fc51b03 | ||
|
b429eaab84 | ||
|
e0104e6d93 |
@@ -120,6 +120,7 @@ Environment="FLANNELD_ETCD_PREFIX=/coreos.com/network2"
|
|||||||
```
|
```
|
||||||
|
|
||||||
List of flannel configuration parameters:
|
List of flannel configuration parameters:
|
||||||
|
|
||||||
- **etcd_endpoints**: Comma separated list of etcd endpoints
|
- **etcd_endpoints**: Comma separated list of etcd endpoints
|
||||||
- **etcd_cafile**: Path to CA file used for TLS communication with etcd
|
- **etcd_cafile**: Path to CA file used for TLS communication with etcd
|
||||||
- **etcd_certfile**: Path to certificate file used for TLS communication with etcd
|
- **etcd_certfile**: Path to certificate file used for TLS communication with etcd
|
||||||
@@ -298,6 +299,7 @@ All but the `passwd` and `ssh-authorized-keys` fields will be ignored if the use
|
|||||||
- **coreos-ssh-import-url**: Authorize SSH keys imported from a url endpoint.
|
- **coreos-ssh-import-url**: Authorize SSH keys imported from a url endpoint.
|
||||||
- **system**: Create the user as a system user. No home directory will be created.
|
- **system**: Create the user as a system user. No home directory will be created.
|
||||||
- **no-log-init**: Boolean. Skip initialization of lastlog and faillog databases.
|
- **no-log-init**: Boolean. Skip initialization of lastlog and faillog databases.
|
||||||
|
- **shell**: User's login shell.
|
||||||
|
|
||||||
The following fields are not yet implemented:
|
The following fields are not yet implemented:
|
||||||
|
|
||||||
|
@@ -374,6 +374,7 @@ users:
|
|||||||
no_user_group: true
|
no_user_group: true
|
||||||
system: y
|
system: y
|
||||||
no_log_init: True
|
no_log_init: True
|
||||||
|
shell: /bin/sh
|
||||||
`
|
`
|
||||||
cfg, err := NewCloudConfig(contents)
|
cfg, err := NewCloudConfig(contents)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -441,6 +442,10 @@ users:
|
|||||||
if !user.NoLogInit {
|
if !user.NoLogInit {
|
||||||
t.Errorf("Failed to parse no_log_init field")
|
t.Errorf("Failed to parse no_log_init field")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if user.Shell != "/bin/sh" {
|
||||||
|
t.Errorf("Failed to parse shell field, got %q", user.Shell)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCloudConfigUsersGithubUser(t *testing.T) {
|
func TestCloudConfigUsersGithubUser(t *testing.T) {
|
||||||
|
@@ -29,4 +29,5 @@ type User struct {
|
|||||||
NoUserGroup bool `yaml:"no_user_group"`
|
NoUserGroup bool `yaml:"no_user_group"`
|
||||||
System bool `yaml:"system"`
|
System bool `yaml:"system"`
|
||||||
NoLogInit bool `yaml:"no_log_init"`
|
NoLogInit bool `yaml:"no_log_init"`
|
||||||
|
Shell string `yaml:"shell"`
|
||||||
}
|
}
|
||||||
|
@@ -57,9 +57,9 @@ func checkEncoding(cfg node, report *Report) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
c := f.Child("contents")
|
c := f.Child("content")
|
||||||
if _, err := config.DecodeContent(c.String(), e.String()); err != nil {
|
if _, err := config.DecodeContent(c.String(), e.String()); err != nil {
|
||||||
report.Error(c.line, fmt.Sprintf("contents cannot be decoded as %q", e.String()))
|
report.Error(c.line, fmt.Sprintf("content cannot be decoded as %q", e.String()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -60,27 +60,27 @@ func TestCheckEncoding(t *testing.T) {
|
|||||||
}{
|
}{
|
||||||
{},
|
{},
|
||||||
{
|
{
|
||||||
config: "write_files:\n - encoding: base64\n contents: aGVsbG8K",
|
config: "write_files:\n - encoding: base64\n content: aGVsbG8K",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
config: "write_files:\n - contents: !!binary aGVsbG8K",
|
config: "write_files:\n - content: !!binary aGVsbG8K",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
config: "write_files:\n - encoding: base64\n contents: !!binary aGVsbG8K",
|
config: "write_files:\n - encoding: base64\n content: !!binary aGVsbG8K",
|
||||||
entries: []Entry{{entryError, `contents cannot be decoded as "base64"`, 3}},
|
entries: []Entry{{entryError, `content cannot be decoded as "base64"`, 3}},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
config: "write_files:\n - encoding: base64\n contents: !!binary YUdWc2JHOEsK",
|
config: "write_files:\n - encoding: base64\n content: !!binary YUdWc2JHOEsK",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
config: "write_files:\n - encoding: gzip\n contents: !!binary H4sIAOC3tVQAA8tIzcnJ5wIAIDA6NgYAAAA=",
|
config: "write_files:\n - encoding: gzip\n content: !!binary H4sIAOC3tVQAA8tIzcnJ5wIAIDA6NgYAAAA=",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
config: "write_files:\n - encoding: gzip+base64\n contents: H4sIAOC3tVQAA8tIzcnJ5wIAIDA6NgYAAAA=",
|
config: "write_files:\n - encoding: gzip+base64\n content: H4sIAOC3tVQAA8tIzcnJ5wIAIDA6NgYAAAA=",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
config: "write_files:\n - encoding: custom\n contents: hello",
|
config: "write_files:\n - encoding: custom\n content: hello",
|
||||||
entries: []Entry{{entryError, `contents cannot be decoded as "custom"`, 3}},
|
entries: []Entry{{entryError, `content cannot be decoded as "custom"`, 3}},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -39,7 +39,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
version = "1.3.2"
|
version = "1.3.4"
|
||||||
datasourceInterval = 100 * time.Millisecond
|
datasourceInterval = 100 * time.Millisecond
|
||||||
datasourceMaxInterval = 30 * time.Second
|
datasourceMaxInterval = 30 * time.Second
|
||||||
datasourceTimeout = 5 * time.Minute
|
datasourceTimeout = 5 * time.Minute
|
||||||
|
@@ -108,7 +108,9 @@ func (scs *serverContextService) FetchMetadata() (metadata datasource.Metadata,
|
|||||||
}
|
}
|
||||||
|
|
||||||
metadata.SSHPublicKeys = map[string]string{}
|
metadata.SSHPublicKeys = map[string]string{}
|
||||||
if key, ok := inputMetadata.Meta["ssh_public_key"]; ok {
|
// CloudSigma uses an empty string, rather than no string,
|
||||||
|
// to represent the lack of a SSH key
|
||||||
|
if key, _ := inputMetadata.Meta["ssh_public_key"]; len(key) > 0 {
|
||||||
splitted := strings.Split(key, " ")
|
splitted := strings.Split(key, " ")
|
||||||
metadata.SSHPublicKeys[splitted[len(splitted)-1]] = key
|
metadata.SSHPublicKeys[splitted[len(splitted)-1]] = key
|
||||||
}
|
}
|
||||||
|
@@ -43,6 +43,27 @@ func (f *fakeCepgoClient) FetchRaw(key string) ([]byte, error) {
|
|||||||
return f.raw, f.err
|
return f.raw, f.err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestServerContextWithEmptyPublicSSHKey(t *testing.T) {
|
||||||
|
client := new(fakeCepgoClient)
|
||||||
|
scs := NewServerContextService()
|
||||||
|
scs.client = client
|
||||||
|
client.raw = []byte(`{
|
||||||
|
"meta": {
|
||||||
|
"base64_fields": "cloudinit-user-data",
|
||||||
|
"cloudinit-user-data": "I2Nsb3VkLWNvbmZpZwoKaG9zdG5hbWU6IGNvcmVvczE=",
|
||||||
|
"ssh_public_key": ""
|
||||||
|
}
|
||||||
|
}`)
|
||||||
|
metadata, err := scs.FetchMetadata()
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(metadata.SSHPublicKeys) != 0 {
|
||||||
|
t.Error("There should be no Public SSH Keys provided")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestServerContextFetchMetadata(t *testing.T) {
|
func TestServerContextFetchMetadata(t *testing.T) {
|
||||||
client := new(fakeCepgoClient)
|
client := new(fakeCepgoClient)
|
||||||
scs := NewServerContextService()
|
scs := NewServerContextService()
|
||||||
|
@@ -72,6 +72,10 @@ func CreateUser(u *config.User) error {
|
|||||||
args = append(args, "--no-log-init")
|
args = append(args, "--no-log-init")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if u.Shell != "" {
|
||||||
|
args = append(args, "--shell", u.Shell)
|
||||||
|
}
|
||||||
|
|
||||||
args = append(args, u.Name)
|
args = append(args, u.Name)
|
||||||
|
|
||||||
output, err := exec.Command("useradd", args...).CombinedOutput()
|
output, err := exec.Command("useradd", args...).CombinedOutput()
|
||||||
|
Reference in New Issue
Block a user