Skip to content

Commit 2ac4ac7

Browse files
fix: Made GetBootstrapper a private member of main module
Signed-off-by: Utkarsh Bhatt <utkarsh.bhatt@canonical.com>
1 parent a8aa0b7 commit 2ac4ac7

4 files changed

Lines changed: 21 additions & 6 deletions

File tree

microceph/cmd/microcephd/bootstrapper.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ type Bootstrapper interface {
1818
Bootstrap(ctx context.Context, state interfaces.StateInterface) error
1919
}
2020

21-
// GetBootstrapper returns a bootstrapper implementation based on the bootstrap parameters.
22-
var GetBootstrapper = func(bd common.BootstrapConfig, state interfaces.StateInterface) (Bootstrapper, error) {
21+
// getBootstrapper returns a bootstrapper implementation based on the bootstrap parameters.
22+
var getBootstrapper = func(bd common.BootstrapConfig, state interfaces.StateInterface) (Bootstrapper, error) {
2323
var bootstrapper Bootstrapper
2424

2525
if len(bd.AdoptFSID) != 0 && len(bd.AdoptMonHosts) != 0 && len(bd.AdoptAdminKey) != 0 {

microceph/cmd/microcephd/hooks.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ func PreInit(ctx context.Context, s state.State, bootstrap bool, initConfig map[
1919
bd := common.BootstrapConfig{}
2020
common.DecodeBootstrapConfig(initConfig, &bd)
2121

22-
bootstrapper, err := GetBootstrapper(bd, interfaces.CephState{State: s})
22+
bootstrapper, err := getBootstrapper(bd, interfaces.CephState{State: s})
2323
if err != nil {
2424
logger.Errorf("failed to get bootstrapper: %v", err)
2525
return err
@@ -38,7 +38,7 @@ func PostBootstrap(ctx context.Context, s state.State, initConfig map[string]str
3838
bd := common.BootstrapConfig{}
3939
common.DecodeBootstrapConfig(initConfig, &bd)
4040

41-
bootstrapper, err := GetBootstrapper(bd, interfaces.CephState{State: s})
41+
bootstrapper, err := getBootstrapper(bd, interfaces.CephState{State: s})
4242
if err != nil {
4343
logger.Errorf("failed to get bootstrapper: %v", err)
4444
return err

microceph/cmd/microcephd/hooks_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func (s *hooksSuite) TestPreInit() {
4646

4747
bootstrapper.On("Precheck", mock.Anything, mock.Anything).Return(nil).Once()
4848

49-
GetBootstrapper = func(bd common.BootstrapConfig, state interfaces.StateInterface) (Bootstrapper, error) {
49+
getBootstrapper = func(bd common.BootstrapConfig, state interfaces.StateInterface) (Bootstrapper, error) {
5050
return bootstrapper, nil
5151
}
5252

@@ -60,7 +60,7 @@ func (s *hooksSuite) TestPostBootstrap() {
6060

6161
bootstrapper.On("Bootstrap", mock.Anything, mock.Anything).Return(nil).Once()
6262

63-
GetBootstrapper = func(bd common.BootstrapConfig, state interfaces.StateInterface) (Bootstrapper, error) {
63+
getBootstrapper = func(bd common.BootstrapConfig, state interfaces.StateInterface) (Bootstrapper, error) {
6464
return bootstrapper, nil
6565
}
6666

tests/scripts/adoptutils.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,21 @@ function create_cephadm_vm() {
1818
lxc storage volume attach default $name-1 $name
1919
lxc storage volume attach default $name-2 $name
2020
lxc storage volume attach default $name-3 $name
21+
22+
status=$(lxc ls | grep $name | cut -d" " -f 4)
23+
for i in $(seq 1 10); do
24+
if [[ $status != "RUNNING" ]]; then
25+
echo "waiting."
26+
sleep 20s
27+
fi
28+
status=$(lxc ls | grep $name | cut -d" " -f 4)
29+
done
30+
31+
status=$(lxc ls | grep $name | cut -d" " -f 4)
32+
if [[ $status != "RUNNING" ]]; then
33+
echo "Timeout waiting for machine"
34+
exit 1
35+
fi
2136
}
2237

2338
function bootstrap_cephadm() {

0 commit comments

Comments
 (0)