Compare commits
31 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
bbe86a216e | ||
|
effc4cec21 | ||
|
75e288c553 | ||
|
0785840fe3 | ||
|
c10bfc2f56 | ||
|
2f954dcdc2 | ||
|
cdfc94f4e9 | ||
|
18e2f98414 | ||
|
4b472795c4 | ||
|
85b8d804c8 | ||
|
1fbbaaec19 | ||
|
667dbd8fb7 | ||
|
6730cb7227 | ||
|
9454522033 | ||
|
c255739a93 | ||
|
2051cd3e1c | ||
|
b52cb3fea3 | ||
|
da5f85b3fb | ||
|
9999178538 | ||
|
8f766e4666 | ||
|
2d28d16c92 | ||
|
e9cd09dd7b | ||
|
8370b30aa2 | ||
|
3e015cc3a1 | ||
|
a0fe6d0884 | ||
|
585ce5fcd9 | ||
|
72445796ca | ||
|
7342d91a85 | ||
|
db1bc51c98 | ||
|
c1f373e648 | ||
|
db49a16002 |
@@ -130,11 +130,11 @@ The `coreos.units.*` parameters define a list of arbitrary systemd units to star
|
|||||||
Each item is an object with the following fields:
|
Each item is an object with the following fields:
|
||||||
|
|
||||||
- **name**: String representing unit's name. Required.
|
- **name**: String representing unit's name. Required.
|
||||||
- **runtime**: Boolean indicating whether or not to persist the unit across reboots. This is analogous to the `--runtime` argument to `systemctl enable`. Default value is false.
|
- **runtime**: Boolean indicating whether or not to persist the unit across reboots. This is analogous to the `--runtime` argument to `systemctl enable`. The default value is false.
|
||||||
- **enable**: Boolean indicating whether or not to handle the [Install] section of the unit file. This is similar to running `systemctl enable <name>`. Default value is false.
|
- **enable**: Boolean indicating whether or not to handle the [Install] section of the unit file. This is similar to running `systemctl enable <name>`. The default value is false.
|
||||||
- **content**: Plaintext string representing entire unit file. If no value is provided, the unit is assumed to exist already.
|
- **content**: Plaintext string representing entire unit file. If no value is provided, the unit is assumed to exist already.
|
||||||
- **command**: Command to execute on unit: start, stop, reload, restart, try-restart, reload-or-restart, reload-or-try-restart. Default value is restart.
|
- **command**: Command to execute on unit: start, stop, reload, restart, try-restart, reload-or-restart, reload-or-try-restart. The default behavior is to not execute any commands.
|
||||||
- **mask**: Whether to mask the unit file by symlinking it to `/dev/null` (analogous to `systemctl mask <name>`). Note that unlike `systemctl mask`, **this will destructively remove any existing unit file** located at `/etc/systemd/system/<unit>`, to ensure that the mask succeeds. Default value is false.
|
- **mask**: Whether to mask the unit file by symlinking it to `/dev/null` (analogous to `systemctl mask <name>`). Note that unlike `systemctl mask`, **this will destructively remove any existing unit file** located at `/etc/systemd/system/<unit>`, to ensure that the mask succeeds. The default value is false.
|
||||||
|
|
||||||
**NOTE:** The command field is ignored for all network, netdev, and link units. The systemd-networkd.service unit will be restarted in their place.
|
**NOTE:** The command field is ignored for all network, netdev, and link units. The systemd-networkd.service unit will be restarted in their place.
|
||||||
|
|
||||||
|
@@ -21,7 +21,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
version = "0.10.0"
|
version = "0.10.5"
|
||||||
datasourceInterval = 100 * time.Millisecond
|
datasourceInterval = 100 * time.Millisecond
|
||||||
datasourceMaxInterval = 30 * time.Second
|
datasourceMaxInterval = 30 * time.Second
|
||||||
datasourceTimeout = 5 * time.Minute
|
datasourceTimeout = 5 * time.Minute
|
||||||
@@ -163,7 +163,7 @@ func main() {
|
|||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ccm != nil {
|
if ccm != nil && flags.convertNetconf != "" {
|
||||||
fmt.Printf("Fetching network config from datasource of type %q\n", ds.Type())
|
fmt.Printf("Fetching network config from datasource of type %q\n", ds.Type())
|
||||||
netconfBytes, err := ds.FetchNetworkConfig(ccm.NetworkConfigPath)
|
netconfBytes, err := ds.FetchNetworkConfig(ccm.NetworkConfigPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@@ -42,6 +42,9 @@ func (cd *configDrive) FetchUserdata() ([]byte, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (cd *configDrive) FetchNetworkConfig(filename string) ([]byte, error) {
|
func (cd *configDrive) FetchNetworkConfig(filename string) ([]byte, error) {
|
||||||
|
if filename == "" {
|
||||||
|
return []byte{}, nil
|
||||||
|
}
|
||||||
return cd.tryReadFile(path.Join(cd.openstackRoot(), filename))
|
return cd.tryReadFile(path.Join(cd.openstackRoot(), filename))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -13,9 +13,9 @@ import (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
DefaultAddress = "http://169.254.169.254/"
|
DefaultAddress = "http://169.254.169.254/"
|
||||||
apiVersion = "2009-04-04"
|
apiVersion = "2009-04-04/"
|
||||||
userdataPath = apiVersion + "/user-data"
|
userdataPath = apiVersion + "user-data"
|
||||||
metadataPath = apiVersion + "/meta-data"
|
metadataPath = apiVersion + "meta-data"
|
||||||
)
|
)
|
||||||
|
|
||||||
type metadataService struct {
|
type metadataService struct {
|
||||||
|
@@ -236,7 +236,11 @@ func parseInterfaceStanza(attributes []string, options []string) (*stanzaInterfa
|
|||||||
for i, field := range fields[:len(fields)-1] {
|
for i, field := range fields[:len(fields)-1] {
|
||||||
switch field {
|
switch field {
|
||||||
case "-net":
|
case "-net":
|
||||||
route.destination.IP = net.ParseIP(fields[i+1])
|
if _, dst, err := net.ParseCIDR(fields[i+1]); err == nil {
|
||||||
|
route.destination = *dst
|
||||||
|
} else {
|
||||||
|
route.destination.IP = net.ParseIP(fields[i+1])
|
||||||
|
}
|
||||||
case "netmask":
|
case "netmask":
|
||||||
route.destination.Mask = net.IPMask(net.ParseIP(fields[i+1]).To4())
|
route.destination.Mask = net.IPMask(net.ParseIP(fields[i+1]).To4())
|
||||||
case "gw":
|
case "gw":
|
||||||
|
@@ -285,31 +285,57 @@ func TestBadParseInterfaceStanzasStaticPostUp(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestParseInterfaceStanzaStaticPostUp(t *testing.T) {
|
func TestParseInterfaceStanzaStaticPostUp(t *testing.T) {
|
||||||
options := []string{
|
for _, tt := range []struct {
|
||||||
"address 192.168.1.100",
|
options []string
|
||||||
"netmask 255.255.255.0",
|
expect []route
|
||||||
"post-up route add gw 192.168.1.1 -net 192.168.1.0 netmask 255.255.255.0",
|
}{
|
||||||
}
|
|
||||||
expect := []route{
|
|
||||||
{
|
{
|
||||||
destination: net.IPNet{
|
options: []string{
|
||||||
IP: net.IPv4(192, 168, 1, 0),
|
"address 192.168.1.100",
|
||||||
Mask: net.IPv4Mask(255, 255, 255, 0),
|
"netmask 255.255.255.0",
|
||||||
|
"post-up route add gw 192.168.1.1 -net 192.168.1.0 netmask 255.255.255.0",
|
||||||
|
},
|
||||||
|
expect: []route{
|
||||||
|
{
|
||||||
|
destination: net.IPNet{
|
||||||
|
IP: net.IPv4(192, 168, 1, 0),
|
||||||
|
Mask: net.IPv4Mask(255, 255, 255, 0),
|
||||||
|
},
|
||||||
|
gateway: net.IPv4(192, 168, 1, 1),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
gateway: net.IPv4(192, 168, 1, 1),
|
|
||||||
},
|
},
|
||||||
}
|
{
|
||||||
|
options: []string{
|
||||||
iface, err := parseInterfaceStanza([]string{"eth", "inet", "static"}, options)
|
"address 192.168.1.100",
|
||||||
if err != nil {
|
"netmask 255.255.255.0",
|
||||||
t.FailNow()
|
"post-up route add gw 192.168.1.1 -net 192.168.1.0/24 || true",
|
||||||
}
|
},
|
||||||
static, ok := iface.configMethod.(configMethodStatic)
|
expect: []route{
|
||||||
if !ok {
|
{
|
||||||
t.FailNow()
|
destination: func() net.IPNet {
|
||||||
}
|
if _, net, err := net.ParseCIDR("192.168.1.0/24"); err == nil {
|
||||||
if !reflect.DeepEqual(static.routes, expect) {
|
return *net
|
||||||
t.FailNow()
|
} else {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}(),
|
||||||
|
gateway: net.IPv4(192, 168, 1, 1),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
} {
|
||||||
|
iface, err := parseInterfaceStanza([]string{"eth", "inet", "static"}, tt.options)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("bad error (%+v): want nil, got %s\n", tt, err)
|
||||||
|
}
|
||||||
|
static, ok := iface.configMethod.(configMethodStatic)
|
||||||
|
if !ok {
|
||||||
|
t.Fatalf("bad config method (%+v): want configMethodStatic, got %T\n", tt, iface.configMethod)
|
||||||
|
}
|
||||||
|
if !reflect.DeepEqual(static.routes, tt.expect) {
|
||||||
|
t.Fatalf("bad routes (%+v): want %#v, got %#v\n", tt, tt.expect, static.routes)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user