Skip to content

Commit

Permalink
Fix PKIServer.create()
Browse files Browse the repository at this point in the history
The PKIServer.create() has been updated to set the properties
in /var/lib/pki/<instance>/conf/tomcat.conf and in its copy at
/etc/sysconfig/<type>@<instance> properly.
  • Loading branch information
edewata committed Dec 5, 2024
1 parent 79c1084 commit ceb4d22
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/server-basic-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ jobs:
run: |
docker exec pki cat /etc/pki/pki-tomcat/server.xml
- name: Check pki-tomcat tomcat.conf
if: always()
run: |
docker exec pki cat /etc/pki/pki-tomcat/tomcat.conf
- name: Check pki-tomcat server logs dir after installation
run: |
# check file types, owners, and permissions
Expand Down Expand Up @@ -299,6 +304,11 @@ jobs:
run: |
docker exec pki cat /var/lib/tomcats/pki/conf/server.xml
- name: Check tomcat@pki tomcat.conf
if: always()
run: |
docker exec pki cat /var/lib/tomcats/pki/conf/tomcat.conf
- name: Check tomcat@pki server logs dir after installation
run: |
# check file types, owners, and permissions
Expand Down
12 changes: 7 additions & 5 deletions base/server/python/pki/server/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,7 @@ def create(self, force=False):
self.create_web_xml(exist_ok=True)

# copy /etc/tomcat/tomcat.conf
# to /var/lib/pki/<instance>/conf/tomcat.conf
self.copy(
Tomcat.TOMCAT_CONF,
self.tomcat_conf,
Expand All @@ -784,21 +785,22 @@ def create(self, force=False):
java_home = os.getenv('JAVA_HOME')
tomcat_conf.set('JAVA_HOME', java_home)

# update CATALINA_BASE
tomcat_conf.set('CATALINA_BASE', self.base_dir)

# store current PKI version
tomcat_conf.set('PKI_VERSION', pki.specification_version())

tomcat_conf.write()

service_conf = os.path.join(SYSCONFIG_DIR, 'tomcat')
# copy /var/lib/pki/<instance>/conf/tomcat.conf
# to /etc/sysconfig/<type>@<instance>
self.copy(
service_conf,
self.tomcat_conf,
self.service_conf,
exist_ok=True,
force=force)

with open(self.service_conf, 'a', encoding='utf-8') as f:
print('CATALINA_BASE="%s"' % self.base_dir, file=f)

def create_conf_dir(self, exist_ok=False):

if self._conf_dir:
Expand Down

0 comments on commit ceb4d22

Please sign in to comment.