Skip to content

Commit f4c42fc

Browse files
Hotfix/azure only reboot nvidia (#135)
* Azure can reboot nvida * else * remove empty line * Pass .cloud template data on tests * cloud * tests * Avoid restyler issues by adjusting trailing newlines Co-authored-by: 0x2b3bfa0 <0x2b3bfa0+git@googlemail.com>
1 parent bbf093c commit f4c42fc

File tree

6 files changed

+22
-8
lines changed

6 files changed

+22
-8
lines changed

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ require (
2626
github.com/masterzen/winrm v0.0.0-20200615185753-c42b5136ff88 // indirect
2727
github.com/mitchellh/gox v1.0.1 // indirect
2828
github.com/packer-community/winrmcp v0.0.0-20180921211025-c76d91c1e7db // indirect
29-
github.com/sebdah/goldie/v2 v2.5.3 // indirect
29+
github.com/sebdah/goldie/v2 v2.5.3
3030
github.com/stretchr/testify v1.6.1
3131
github.com/teris-io/shortid v0.0.0-20171029131806-771a37caa5cf
3232
github.com/tombuildsstuff/giovanni v0.12.0 // indirect
@@ -35,7 +35,7 @@ require (
3535
golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0
3636
golang.org/x/tools v0.0.0-20201028111035-eafbe7b904eb // indirect
3737
google.golang.org/api v0.34.0 // indirect
38-
gopkg.in/alessio/shellescape.v1 v1.0.0-20170105083845-52074bc9df61 // indirect
38+
gopkg.in/alessio/shellescape.v1 v1.0.0-20170105083845-52074bc9df61
3939
k8s.io/api v0.20.5
4040
k8s.io/apimachinery v0.20.5
4141
k8s.io/client-go v0.20.5

iterative/resource_runner.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,8 +338,15 @@ sudo bash -c 'cat << EOF > /etc/systemd/system/cml.service
338338
WantedBy=multi-user.target
339339
EOF'
340340
341+
{{if .cloud}}
342+
{{if eq .cloud "azure"}}
341343
sudo systemctl enable cml.service
342344
sudo reboot
345+
{{- else}}
346+
sudo systemctl daemon-reload
347+
sudo systemctl enable cml.service --now
348+
{{- end}}
349+
{{- end}}
343350
{{- end}}
344351
`)
345352
var customDataBuffer bytes.Buffer

iterative/resource_runner_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ package iterative
22

33
import (
44
"encoding/base64"
5-
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
6-
"github.com/sebdah/goldie/v2"
75
"os"
86
"testing"
97

8+
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
9+
"github.com/sebdah/goldie/v2"
10+
1011
"github.com/stretchr/testify/assert"
1112
)
1213

iterative/testdata/script_template_cloud_aws.golden

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,5 +78,7 @@ sudo bash -c 'cat << EOF > /etc/systemd/system/cml.service
7878
WantedBy=multi-user.target
7979
EOF'
8080

81-
sudo systemctl enable cml.service
82-
sudo reboot
81+
82+
83+
sudo systemctl daemon-reload
84+
sudo systemctl enable cml.service --now

iterative/testdata/script_template_cloud_azure.golden

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,5 +79,7 @@ sudo bash -c 'cat << EOF > /etc/systemd/system/cml.service
7979
WantedBy=multi-user.target
8080
EOF'
8181

82+
83+
8284
sudo systemctl enable cml.service
8385
sudo reboot

iterative/testdata/script_template_cloud_invalid.golden

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,5 +74,7 @@ sudo bash -c 'cat << EOF > /etc/systemd/system/cml.service
7474
WantedBy=multi-user.target
7575
EOF'
7676

77-
sudo systemctl enable cml.service
78-
sudo reboot
77+
78+
79+
sudo systemctl daemon-reload
80+
sudo systemctl enable cml.service --now

0 commit comments

Comments
 (0)