Merge pull request #301 from crawford/github

config: add support for multiple github users
This commit is contained in:
Alex Crawford 2015-01-20 14:26:38 -08:00
commit 44142ff8af
2 changed files with 20 additions and 13 deletions

View File

@ -17,17 +17,18 @@
package config package config
type User struct { type User struct {
Name string `yaml:"name"` Name string `yaml:"name"`
PasswordHash string `yaml:"passwd"` PasswordHash string `yaml:"passwd"`
SSHAuthorizedKeys []string `yaml:"ssh_authorized_keys"` SSHAuthorizedKeys []string `yaml:"ssh_authorized_keys"`
SSHImportGithubUser string `yaml:"coreos_ssh_import_github"` SSHImportGithubUser string `yaml:"coreos_ssh_import_github"`
SSHImportURL string `yaml:"coreos_ssh_import_url"` SSHImportGithubUsers []string `yaml:"coreos_ssh_import_github_users"`
GECOS string `yaml:"gecos"` SSHImportURL string `yaml:"coreos_ssh_import_url"`
Homedir string `yaml:"homedir"` GECOS string `yaml:"gecos"`
NoCreateHome bool `yaml:"no_create_home"` Homedir string `yaml:"homedir"`
PrimaryGroup string `yaml:"primary_group"` NoCreateHome bool `yaml:"no_create_home"`
Groups []string `yaml:"groups"` PrimaryGroup string `yaml:"primary_group"`
NoUserGroup bool `yaml:"no_user_group"` Groups []string `yaml:"groups"`
System bool `yaml:"system"` NoUserGroup bool `yaml:"no_user_group"`
NoLogInit bool `yaml:"no_log_init"` System bool `yaml:"system"`
NoLogInit bool `yaml:"no_log_init"`
} }

View File

@ -87,6 +87,12 @@ func Apply(cfg config.CloudConfig, env *Environment) error {
return err return err
} }
} }
for _, u := range user.SSHImportGithubUsers {
log.Printf("Authorizing github user %s SSH keys for CoreOS user '%s'", u, user.Name)
if err := SSHImportGithubUser(user.Name, u); err != nil {
return err
}
}
if user.SSHImportURL != "" { if user.SSHImportURL != "" {
log.Printf("Authorizing SSH keys for CoreOS user '%s' from '%s'", user.Name, user.SSHImportURL) log.Printf("Authorizing SSH keys for CoreOS user '%s' from '%s'", user.Name, user.SSHImportURL)
if err := SSHImportKeysFromURL(user.Name, user.SSHImportURL); err != nil { if err := SSHImportKeysFromURL(user.Name, user.SSHImportURL); err != nil {