Skip to content

Commit 6e9e838

Browse files
author
Jeff McCune
committed
Move stages to after main
Working with the stages in stdlib, I quickly ran into an issue where most of the stages were before the main stage. This made it difficult to declare any resources in a traditional "include" style class while hiding the end user from the stages being associated with other module classes. For example, in class mcollective, a package would be declared in main. However, if mcollective declared class mcollective::service in stage infra_deploy and this was before main, there would be a dependency loop between the package and the service. There appears to be a convention around "chain your stages after main" to avoid the need to create relatively empty shell classes.
1 parent 46533ae commit 6e9e838

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

manifests/stages.pp

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
# The high level stages are (In order):
66
#
77
# * setup
8-
# * deploy
8+
# * main
99
# * runtime
1010
# * setup_infra
1111
# * deploy_infra
12-
# * main
1312
# * setup_app
1413
# * deploy_app
14+
# * deploy
1515
#
1616
# Parameters:
1717
#
@@ -31,15 +31,12 @@
3131
#
3232
class stdlib::stages {
3333

34-
stage { 'setup': before => Stage['deploy'] }
35-
stage { 'deploy': before => Stage['setup_infra'] }
36-
stage { 'runtime':
37-
require => Stage['deploy'],
38-
before => Stage['setup_infra'],
39-
}
40-
stage { 'setup_infra': before => Stage['deploy_infra'] }
41-
stage { 'deploy_infra': before => Stage['main'] }
42-
stage { 'setup_app': require => Stage['main'] }
43-
stage { 'deploy_app': require => Stage['setup_app'] }
34+
stage { 'setup': before => Stage['main'] }
35+
stage { 'runtime': require => Stage['main'] }
36+
-> stage { 'setup_infra': }
37+
-> stage { 'deploy_infra': }
38+
-> stage { 'setup_app': }
39+
-> stage { 'deploy_app': }
40+
-> stage { 'deploy': }
4441

4542
}

0 commit comments

Comments
 (0)