Skip to content
This repository was archived by the owner on Jan 21, 2020. It is now read-only.

Commit 928f3e3

Browse files
author
David Chung
authored
Misc fixes for playbook, changing debug output for CLI (#547)
* Playbook fix; change warnings to debug statements for CLI Signed-off-by: David Chung <[email protected]> * fix bad playbook command line usage Signed-off-by: David Chung <[email protected]>
1 parent ce00509 commit 928f3e3

File tree

10 files changed

+19
-15
lines changed

10 files changed

+19
-15
lines changed

docs/playbooks/linuxkit/examples/sshd/hyperkit/destroy-instances.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
{{ $plugin := flag "instance-plugin" "string" "Name of plugin" | prompt "What instance plugin to target?" "string" "instance-hyperkit" }}
44

5-
infrakit instance --name {{ $plugin }} describe -q | awk '{print $1}' | xargs infrakit instance --name {{ $plugin }} destroy
5+
infrakit {{ $plugin }} describe -q | awk '{print $1}' | xargs infrakit instance --name {{ $plugin }} destroy
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{{/* =% sh %= */}}
22

3-
infrakit instance --name instance-hyperkit describe
3+
infrakit instance-hyperkit describe

docs/playbooks/linuxkit/examples/sshd/packet/destroy-instances.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
{{ $plugin := flag "instance-plugin" "string" "Name of plugin" | prompt "What instance plugin to target?" "string" "instance-packet" }}
44

5-
infrakit instance --name {{ $plugin }} describe -q | awk '{print $1}' | xargs infrakit instance --name {{ $plugin }} destroy
5+
infrakit {{ $plugin }} describe -q | awk '{print $1}' | xargs infrakit instance --name {{ $plugin }} destroy
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{{/* =% sh %= */}}
22

3-
infrakit instance --name instance-packet describe
3+
infrakit instance-packet describe

docs/playbooks/linuxkit/examples/sshd/packet/scale-group.ikt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
facility: {{ $facility }}
3434
operating_system: custom_ipxe
3535
billing_cycle: hourly
36+
hostname_prefix: infrakit-{{ $groupName }}
37+
checksum: {{ $checksum }}
3638
userdata: |
3739
#!ipxe
3840

@@ -42,5 +44,3 @@
4244
kernel ${base-url}/{{$bundle}}-kernel ${kernel-params}
4345
initrd ${base-url}/{{$bundle}}-initrd.img
4446
boot
45-
hostname_prefix: infrakit-demo
46-
checksum: {{ $checksum }}

docs/playbooks/linuxkit/start-infrakit.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ docker run -d --volumes-from infrakit --name manager \
4949
echo "Updating hosts file"
5050
{{ $hostsFile := list (env `INFRAKIT_HOME`) `/hosts` | join `` }}
5151
{{ $hosts := include (list `file://` $hostsFile | join ``) | yamlDecode }}
52-
{{ $_ := set $hosts `localhost` (list `localhost` $port | join `:`) }}
52+
{{ $_ := set $hosts `docker4mac` (list `localhost` $port | join `:`) }}
5353
echo "{{ $hosts | yamlEncode }}" > {{ $hostsFile }}
54-
echo "Updated hosts file. You are using the host `localhost` as defined in your hosts file in INFRAKIT_HOME/hosts"
54+
echo "Updated hosts file. You are using the remote `docker4mac` as defined in your hosts file in INFRAKIT_HOME/hosts"
5555

5656
echo "Started hyperkit: {{ var `started-hyperkit` }}"
5757
echo "Started gcp: {{ var `started-gcp` }}"

pkg/cli/registry.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,14 @@ func getPluginObjects(hs rpc.Handshaker, major string) map[string][]spi.Interfac
5050
// The spi this object implements (e.g. Instance/0.5.0)
5151
spis, err := hs.Implements()
5252
if err != nil {
53-
log.Warn("error getting interface", "name", major, "err", err)
53+
log.Debug("error getting interface", "name", major, "err", err)
5454
return objects
5555
}
5656

5757
// For each spi, eg. Instance/0.5.0 a list of object names
5858
typesBySpi, err := hs.Types()
5959
if err != nil {
60-
log.Warn("error getting typed objects in this plugin", "name", major, "err", err)
60+
log.Debug("error getting typed objects in this plugin", "name", major, "err", err)
6161

6262
// Here we assume there are no lower level objects
6363
objects[major] = spis
@@ -108,7 +108,7 @@ func LoadAll(services *Services) ([]*cobra.Command, error) {
108108
for major, entry := range running {
109109
hs, err := client.NewHandshaker(entry.Address)
110110
if err != nil {
111-
log.Warn("handshaker error", "err", err, "addr", entry.Address)
111+
log.Debug("handshaker error", "err", err, "addr", entry.Address)
112112
continue
113113
}
114114

pkg/cli/remote/remote.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ loop:
115115
moduleURL = SourceURL(u.String())
116116

117117
} else {
118-
log.Warn("cannot resolve", "op", op, "url", moduleURL, "parent", parentURL)
118+
log.Debug("cannot resolve", "op", op, "url", moduleURL, "parent", parentURL)
119119
continue loop
120120
}
121121
}
@@ -142,7 +142,7 @@ loop:
142142
copy := moduleURL
143143
subs, err := list(plugins, mods, input, cmd, &copy)
144144
if err != nil {
145-
log.Warn("cannot list", "op", op, "url", moduleURL, "err", err)
145+
log.Debug("cannot list", "op", op, "url", moduleURL, "err", err)
146146
continue loop
147147
}
148148
for _, sub := range subs {
@@ -158,7 +158,7 @@ loop:
158158
}
159159
err := ctx.BuildFlags()
160160
if err != nil {
161-
log.Warn("cannot build flags", "op", op, "url", moduleURL, "err", err)
161+
log.Debug("cannot build flags", "op", op, "url", moduleURL, "err", err)
162162
continue loop
163163
}
164164

pkg/plugin/instance/packet/plugin.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
"github.com/packethost/packngo"
1515
)
1616

17-
var log = logutil.New("module", "plugin/instance/packetnet")
17+
var log = logutil.New("module", "plugin/instance/packet")
1818

1919
func init() {
2020
rand.Seed(time.Now().UTC().UnixNano())

pkg/template/fetch.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ func doHTTPGet(u *url.URL, customize func(*http.Request), client *http.Client) (
5050
if err != nil {
5151
return nil, err
5252
}
53+
54+
if resp.StatusCode != http.StatusOK {
55+
return []byte{}, fmt.Errorf("error %s", resp.Status)
56+
}
5357
defer resp.Body.Close()
5458
return ioutil.ReadAll(resp.Body)
5559
}

0 commit comments

Comments
 (0)