@@ -52,11 +52,95 @@ def spawn(self, deployer):
52
52
# Create /var/lib/pki/<instance>
53
53
instance .makedirs (instance .base_dir , exist_ok = True )
54
54
55
- logger . info ( 'Creating %s' , instance . conf_dir )
55
+ # Create /etc/pki/< instance>
56
56
instance .makedirs (instance .conf_dir , exist_ok = True )
57
57
58
+ # Create /var/log/pki/<instance>
59
+ instance .makedirs (instance .log_dir , exist_ok = True )
60
+
61
+ # Create /var/lib/pki/<instance>/temp
62
+ instance .makedirs (instance .temp_dir , exist_ok = True )
63
+
64
+ # Create /var/lib/pki/<instance>/work
65
+ instance .makedirs (instance .work_dir , exist_ok = True )
66
+
67
+ # Create /etc/pki/<instance>/certs
58
68
instance .makedirs (instance .certs_dir , exist_ok = True )
59
69
70
+ # Create /etc/pki/<instance>/Catalina
71
+ catalina_dir = os .path .join (instance .conf_dir , 'Catalina' )
72
+ instance .makedirs (catalina_dir , exist_ok = True )
73
+
74
+ # Create /etc/pki/<instance>/Catalina/localhost
75
+ localhost_dir = os .path .join (catalina_dir , 'localhost' )
76
+ instance .makedirs (localhost_dir , exist_ok = True )
77
+
78
+ shared_conf_path = os .path .join (
79
+ pki .server .PKIServer .SHARE_DIR ,
80
+ 'server' ,
81
+ 'conf' )
82
+
83
+ # Link /etc/pki/<instance>/catalina.properties
84
+ # to /usr/share/pki/server/conf/catalina.properties.
85
+ instance .symlink (
86
+ os .path .join (shared_conf_path , 'catalina.properties' ),
87
+ os .path .join (instance .conf_dir , 'catalina.properties' ),
88
+ exist_ok = True )
89
+
90
+ # Link /etc/pki/<instance>/context.xml
91
+ # to /usr/share/tomcat/conf/context.xml.
92
+ context_xml = os .path .join (pki .server .Tomcat .CONF_DIR , 'context.xml' )
93
+ instance .symlink (
94
+ context_xml ,
95
+ instance .context_xml ,
96
+ exist_ok = True )
97
+
98
+ # Link /etc/pki/<instance>/logging.properties
99
+ # to /usr/share/pki/server/conf/logging.properties.
100
+ instance .symlink (
101
+ os .path .join (shared_conf_path , 'logging.properties' ),
102
+ os .path .join (instance .conf_dir , 'logging.properties' ),
103
+ exist_ok = True )
104
+
105
+ # Link /etc/pki/<instance>/web.xml
106
+ # to /usr/share/tomcat/conf/web.xml.
107
+ web_xml = os .path .join (pki .server .Tomcat .CONF_DIR , 'web.xml' )
108
+ instance .symlink (
109
+ web_xml ,
110
+ instance .web_xml ,
111
+ exist_ok = True )
112
+
113
+ # Rewrite rules are subsystem-specific, but the config is server-wide.
114
+ # So we deploy them as part of the server config, regardless of which
115
+ # subsystem(s) will eventually be deployed.
116
+ logger .info ('Deploying HTTP rewrite rules (rewrite.config)' )
117
+ instance .symlink (
118
+ os .path .join (shared_conf_path , 'Catalina' , 'localhost' , 'rewrite.config' ),
119
+ os .path .join (localhost_dir , 'rewrite.config' ),
120
+ exist_ok = True ,
121
+ )
122
+
123
+ # Link /var/lib/pki/<instance>/bin to /usr/share/tomcat/bin
124
+ bin_dir = os .path .join (pki .server .Tomcat .SHARE_DIR , 'bin' )
125
+ instance .symlink (
126
+ bin_dir ,
127
+ instance .bin_dir ,
128
+ exist_ok = True )
129
+
130
+ # Link /var/lib/pki/<instance>/conf to /etc/pki/<instance>
131
+ conf_link = os .path .join (instance .base_dir , 'conf' )
132
+ instance .symlink (
133
+ instance .conf_dir ,
134
+ conf_link ,
135
+ exist_ok = True )
136
+
137
+ # Link /var/lib/pki/<instance>/logs to /var/log/pki/<instance>
138
+ logs_link = os .path .join (instance .base_dir , 'logs' )
139
+ instance .symlink (
140
+ instance .log_dir ,
141
+ logs_link ,
142
+ exist_ok = True )
143
+
60
144
# Configuring internal token password
61
145
62
146
internal_token = deployer .mdict ['pki_self_signed_token' ]
@@ -124,37 +208,8 @@ def spawn(self, deployer):
124
208
logger .info ('Installing %s instance' , instance .name )
125
209
return
126
210
127
- deployer .directory .create (instance .log_dir )
128
-
129
- shared_conf_path = os .path .join (
130
- pki .server .PKIServer .SHARE_DIR ,
131
- 'server' ,
132
- 'conf' )
133
-
134
211
deployer .configure_server_xml ()
135
212
136
- # Link /etc/pki/<instance>/catalina.properties
137
- # to /usr/share/pki/server/conf/catalina.properties.
138
- instance .symlink (
139
- os .path .join (shared_conf_path , 'catalina.properties' ),
140
- os .path .join (instance .conf_dir , 'catalina.properties' ),
141
- exist_ok = True )
142
-
143
- # Link /etc/pki/<instance>/context.xml
144
- # to /usr/share/tomcat/conf/context.xml.
145
- context_xml = os .path .join (pki .server .Tomcat .CONF_DIR , 'context.xml' )
146
- instance .symlink (
147
- context_xml ,
148
- instance .context_xml ,
149
- exist_ok = True )
150
-
151
- # Link /etc/pki/<instance>/logging.properties
152
- # to /usr/share/pki/server/conf/logging.properties.
153
- instance .symlink (
154
- os .path .join (shared_conf_path , 'logging.properties' ),
155
- os .path .join (instance .conf_dir , 'logging.properties' ),
156
- exist_ok = True )
157
-
158
213
# Copy /usr/share/pki/server/conf/tomcat.conf
159
214
# to /etc/sysconfig/<instance>
160
215
@@ -176,33 +231,6 @@ def spawn(self, deployer):
176
231
os .path .join (instance .conf_dir , 'tomcat.conf' ),
177
232
overwrite_flag = True )
178
233
179
- # Link /etc/pki/<instance>/web.xml
180
- # to /usr/share/tomcat/conf/web.xml.
181
- web_xml = os .path .join (pki .server .Tomcat .CONF_DIR , 'web.xml' )
182
- instance .symlink (
183
- web_xml ,
184
- instance .web_xml ,
185
- exist_ok = True )
186
-
187
- # Create /etc/pki/<instance>/Catalina
188
- catalina_dir = os .path .join (instance .conf_dir , 'Catalina' )
189
- instance .makedirs (catalina_dir , exist_ok = True )
190
-
191
- # Create /etc/pki/<instance>/Catalina/localhost
192
- localhost_dir = os .path .join (catalina_dir , 'localhost' )
193
- instance .makedirs (localhost_dir , exist_ok = True )
194
-
195
- # Rewrite rules are subsystem-specific, but the config is server-wide.
196
- # So we deploy them as part of the server config, regardless of which
197
- # subsystem(s) will eventually be deployed.
198
- #
199
- logger .info ('Deploying HTTP rewrite rules (rewrite.config)' )
200
- instance .symlink (
201
- os .path .join (shared_conf_path , 'Catalina' , 'localhost' , 'rewrite.config' ),
202
- os .path .join (localhost_dir , 'rewrite.config' ),
203
- exist_ok = True ,
204
- )
205
-
206
234
logger .info ('Deploying ROOT web application' )
207
235
# Copy /usr/share/pki/server/conf/ROOT.xml
208
236
# to /etc/pki/<instance>/Catalina/localhost/ROOT.xml
@@ -232,36 +260,6 @@ def spawn(self, deployer):
232
260
instance .with_maven_deps = deployer .with_maven_deps
233
261
instance .create_libs (force = True )
234
262
235
- # Create /var/lib/pki/<instance>/temp
236
- deployer .directory .create (instance .temp_dir )
237
-
238
- # Create /var/lib/pki/<instance>/work
239
- deployer .directory .create (instance .work_dir )
240
-
241
- # Link /var/lib/pki/<instance>/bin to /usr/share/tomcat/bin
242
- instance .symlink (
243
- deployer .mdict ['pki_tomcat_bin_path' ],
244
- instance .bin_dir ,
245
- exist_ok = True )
246
-
247
- # Link /var/lib/pki/<instance>/conf to /etc/pki/<instance>
248
- conf_link = os .path .join (instance .base_dir , 'conf' )
249
- instance .symlink (
250
- instance .conf_dir ,
251
- conf_link ,
252
- exist_ok = True )
253
-
254
- # Create /etc/pki/<instance>/certs
255
- certs_path = os .path .join (instance .conf_dir , 'certs' )
256
- deployer .directory .create (certs_path )
257
-
258
- # Link /var/lib/pki/<instance>/logs to /var/log/pki/<instance>
259
- logs_link = os .path .join (instance .base_dir , 'logs' )
260
- instance .symlink (
261
- instance .log_dir ,
262
- logs_link ,
263
- exist_ok = True )
264
-
265
263
if config .str2bool (deployer .mdict ['pki_registry_enable' ]):
266
264
instance .create_registry ()
267
265
0 commit comments