mirror of
https://github.com/opentofu/opentofu.git
synced 2025-01-02 12:17:39 -06:00
831bae8624
This introduces a provider for Cobbler. Cobbler manages bare-metal deployments and, to some extent, virtual machines. This initial commit supports the following resources: distros, profiles, systems, kickstart files, and snippets.
34 lines
498 B
Go
34 lines
498 B
Go
package cobbler
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
cobbler "github.com/jtopjian/cobblerclient"
|
|
)
|
|
|
|
type Config struct {
|
|
Url string
|
|
Username string
|
|
Password string
|
|
|
|
cobblerClient cobbler.Client
|
|
}
|
|
|
|
func (c *Config) loadAndValidate() error {
|
|
config := cobbler.ClientConfig{
|
|
Url: c.Url,
|
|
Username: c.Username,
|
|
Password: c.Password,
|
|
}
|
|
|
|
client := cobbler.NewClient(http.DefaultClient, config)
|
|
_, err := client.Login()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
c.cobblerClient = client
|
|
|
|
return nil
|
|
}
|