Skip to content

Commit d060feb

Browse files
davewalterKalai Wei
authored and
Kalai Wei
committed
Configure director properties first
[#153952078] Signed-off-by: Kalai Wei <[email protected]>
1 parent 4b80cbb commit d060feb

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

commands/configure_director.go

+14-14
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,20 @@ func (c ConfigureDirector) Execute(args []string) error {
4141
return fmt.Errorf("could not parse configure-director flags: %s", err)
4242
}
4343

44+
c.logger.Printf("started configuring director options for bosh tile")
45+
46+
err = c.service.Properties(api.DirectorProperties{
47+
DirectorConfiguration: json.RawMessage(c.Options.DirectorConfiguration),
48+
IAASConfiguration: json.RawMessage(c.Options.IAASConfiguration),
49+
SecurityConfiguration: json.RawMessage(c.Options.SecurityConfiguration),
50+
SyslogConfiguration: json.RawMessage(c.Options.SyslogConfiguration),
51+
})
52+
if err != nil {
53+
return fmt.Errorf("properties could not be applied: %s", err)
54+
}
55+
56+
c.logger.Printf("finished configuring director options for bosh tile")
57+
4458
if c.Options.AZConfiguration != "" {
4559
c.logger.Printf("started configuring availability zone options for bosh tile")
4660

@@ -78,20 +92,6 @@ func (c ConfigureDirector) Execute(args []string) error {
7892
c.logger.Printf("finished configuring network assignment options for bosh tile")
7993
}
8094

81-
c.logger.Printf("started configuring director options for bosh tile")
82-
83-
err = c.service.Properties(api.DirectorProperties{
84-
DirectorConfiguration: json.RawMessage(c.Options.DirectorConfiguration),
85-
IAASConfiguration: json.RawMessage(c.Options.IAASConfiguration),
86-
SecurityConfiguration: json.RawMessage(c.Options.SecurityConfiguration),
87-
SyslogConfiguration: json.RawMessage(c.Options.SyslogConfiguration),
88-
})
89-
if err != nil {
90-
return fmt.Errorf("properties could not be applied: %s", err)
91-
}
92-
93-
c.logger.Printf("finished configuring director options for bosh tile")
94-
9595
return nil
9696
}
9797

commands/configure_director_test.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,14 @@ var _ = Describe("ConfigureDirector", func() {
6464
}))
6565

6666
Expect(logger.PrintfCallCount()).To(Equal(8))
67-
Expect(logger.PrintfArgsForCall(0)).To(Equal("started configuring availability zone options for bosh tile"))
68-
Expect(logger.PrintfArgsForCall(1)).To(Equal("finished configuring availability zone options for bosh tile"))
69-
Expect(logger.PrintfArgsForCall(2)).To(Equal("started configuring network options for bosh tile"))
70-
Expect(logger.PrintfArgsForCall(3)).To(Equal("finished configuring network options for bosh tile"))
71-
Expect(logger.PrintfArgsForCall(4)).To(Equal("started configuring network assignment options for bosh tile"))
72-
Expect(logger.PrintfArgsForCall(5)).To(Equal("finished configuring network assignment options for bosh tile"))
73-
Expect(logger.PrintfArgsForCall(6)).To(Equal("started configuring director options for bosh tile"))
74-
Expect(logger.PrintfArgsForCall(7)).To(Equal("finished configuring director options for bosh tile"))
67+
Expect(logger.PrintfArgsForCall(0)).To(Equal("started configuring director options for bosh tile"))
68+
Expect(logger.PrintfArgsForCall(1)).To(Equal("finished configuring director options for bosh tile"))
69+
Expect(logger.PrintfArgsForCall(2)).To(Equal("started configuring availability zone options for bosh tile"))
70+
Expect(logger.PrintfArgsForCall(3)).To(Equal("finished configuring availability zone options for bosh tile"))
71+
Expect(logger.PrintfArgsForCall(4)).To(Equal("started configuring network options for bosh tile"))
72+
Expect(logger.PrintfArgsForCall(5)).To(Equal("finished configuring network options for bosh tile"))
73+
Expect(logger.PrintfArgsForCall(6)).To(Equal("started configuring network assignment options for bosh tile"))
74+
Expect(logger.PrintfArgsForCall(7)).To(Equal("finished configuring network assignment options for bosh tile"))
7575
})
7676

7777
Context("when no director configuration flags are provided", func() {

0 commit comments

Comments
 (0)