New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ipaplatform: Add Debian platform module. #373
Conversation
|
|
||
| # Mappings from service names as FreeIPA code references to these services | ||
| # to their actual systemd service names | ||
| debian_system_units = redhat_services.redhat_system_units |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please create a copy of the dict with redhat_services.redhat_system_units.copy()
| ports = base_services.wellknownports[self.service_name] | ||
| if ports: | ||
| ipautil.wait_for_open_ports('localhost', ports, self.api.env.startup_timeout) | ||
| def stop(self, instance_name='', capture_output=True): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing an empty line before def stop
| def tune_nofile_platform(self): | ||
| return True | ||
|
|
||
| # For services which have no Debian counterpart |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pep8 wants two empty lines between classes.
|
|
||
| BaseTask = BaseTaskNamespace() | ||
|
|
||
| class DebianTaskNamespace(RedHatTaskNamespace): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
two empty lines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for you contribution! Please find some comments inline, some more may come.
| """ | ||
|
|
||
| from ipaplatform.paths import paths | ||
| from ipaplatform.base.tasks import * |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't use wildcard imports, QuantifiedCode is having a bad day if you do.
| return True | ||
|
|
||
| def parse_ipa_version(self, version): | ||
| return BaseTask.parse_ipa_version(version) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could perhaps make parse_ipa_version a static method so that you don't have to create a BaseTaskNamespace instance just for this one purpose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so something like:
from pkg_resources import parse_version
...
def parse_ipa_version(self, version):
return parse_version(version)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I meant was to add @staticmethod before BaseTaskNamespace parse_version definition so that it goes something like this:
class BaseTaskNamespace(object):
...
@staticmethod
def parse_ipa_version(version):
"""
:param version: textual version
:return: object implementing proper __cmp__ method for version compare
"""
return parse_version(version)Note the removal of self which is not needed in the method anyway so it being static is actually the preferred way. Once you do this, you can go:
class DebianTaskNamespace(RedHatTaskNamespace):
...
def parse_ipa_version(self, version):
return BaseTaskNamespace.parse_ipa_version(version)Note that your parse_ipa_version can itself be static as it uses none of the instance members stored in self :)
394f36a
to
3bce583
Compare
|
pylint is failing: |
| installed = True | ||
| try: | ||
| ipautil.run([paths.SBIN_SERVICE, self.service_name, "status"]) | ||
| except ipautil.CalledProcessError, e: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use the (not so) new syntax except ipautil.CalledProcessError as e, this breaks Python 3.
1d9022b
to
c7b64b7
Compare
| SYSTEMD_SYSTEM_HTTPD_D_DIR = "/etc/systemd/system/apache2.service.d/" | ||
| SYSTEMD_SYSTEM_HTTPD_IPA_CONF = "/etc/systemd/system/apache2.service.d/ipa.conf" | ||
| DNSSEC_TRUSTED_KEY = "/etc/bind/trusted-key.key" | ||
| KRA_AGENT_PEM = "/etc/apache2/nssdb/kra-agent.pem" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NOTE to myself: the location of KRA_AGENT_PEM changes in #367 to a distro-common location so we'll be able to remove this once <-- is pulled.
| KRB5CC_HTTPD = "/var/run/apache2/ipa/krbcache/krb5ccache" | ||
| IPA_CUSTODIA_SOCKET = "/run/apache2/ipa-custodia.sock" | ||
| IPA_CUSTODIA_AUDIT_LOG = '/var/log/ipa-custodia.audit.log' | ||
| IPA_GETKEYTAB = '/usr/sbin/ipa-getkeytab' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This path is the same as in BasePathNamespace so it may not be needed here.
v2: - use redhat_services.redhat_system_units.copy - don't use wildcard imports - add some empty lines to make pep8 happy v3: - make parse_ipa_version static v4: - make more methods static v5: - fix pylint issues - use syntax that doesn't break with python3 v6: - remove IPA_GETKEYTAB from paths, it's the same across distros
c7b64b7
to
6b490e2
Compare
|
@stlaz the patch looks fine to me now. I can't comment on the path values, though. Do you like to see additional modifications? |
|
@tiran I would like to test this in a Vagrant box before pushing it edit: we're not quite there yet, will give it a final read |
|
The patch seems fine, I could have some nitpicks but nothing really imporant. ACK. |
|
Fixed upstream |
Hi, this just adds the Debian platform module. There are still other changes needed before vanilla master can be used on Debian or it's derivatives, but they need bigger changes while this is mostly standalone.