Compare commits
2 commits
de7a678640
...
9892646814
| Author | SHA1 | Date | |
|---|---|---|---|
|
9892646814 |
|||
|
93a2bc6d33 |
3 changed files with 6 additions and 18 deletions
|
|
@ -7,6 +7,7 @@ import (
|
||||||
configuration "git.g3e.fr/syonad/two/internal/config/agent"
|
configuration "git.g3e.fr/syonad/two/internal/config/agent"
|
||||||
"git.g3e.fr/syonad/two/internal/load_db/nocloud"
|
"git.g3e.fr/syonad/two/internal/load_db/nocloud"
|
||||||
"git.g3e.fr/syonad/two/pkg/db/kv"
|
"git.g3e.fr/syonad/two/pkg/db/kv"
|
||||||
|
"git.g3e.fr/syonad/two/pkg/systemd"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
@ -22,6 +23,8 @@ func main() {
|
||||||
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
|
service, _ := systemd.New()
|
||||||
|
|
||||||
conf, err := configuration.LoadConfig(*conf_file)
|
conf, err := configuration.LoadConfig(*conf_file)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
|
|
@ -43,7 +46,9 @@ func main() {
|
||||||
Password: *password,
|
Password: *password,
|
||||||
SSHKEY: *ssh_key,
|
SSHKEY: *ssh_key,
|
||||||
}, db)
|
}, db)
|
||||||
|
service.Start("metadata@" + *vm_name)
|
||||||
} else if *stop {
|
} else if *stop {
|
||||||
nocloud.UnLoadNoCloudInDB(*vm_name, db)
|
nocloud.UnLoadNoCloudInDB(*vm_name, db)
|
||||||
|
service.Stop("metadata@" + *vm_name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ After=network.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
ExecStart=/usr/local/bin/run-metadata-in-netns.sh %i
|
ExecStart=/opt/two/bin/metadata --vm %i
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# Expects one argument: netns_bridge (e.g. vpc-00003_br-00002 or vpc1_br0)
|
|
||||||
arg="$1"
|
|
||||||
NETNS="${arg%%_*}"
|
|
||||||
ip_port="${arg#*_}"
|
|
||||||
IP="${ip_port%%-*}"
|
|
||||||
PORT="${ip_port#*-}"
|
|
||||||
|
|
||||||
echo "start metadata ${NETNS} "
|
|
||||||
|
|
||||||
exec ip netns exec "${NETNS}" \
|
|
||||||
/usr/bin/metadata \
|
|
||||||
-file "/opt/metadata/${arg}.conf" \
|
|
||||||
-interface "${IP}" \
|
|
||||||
-port "${PORT}"
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue