Browse Source

Ticket 48953 - Skip labelling and unlabelling ports during the test

Description:
    In CI creating and removing instances takes most of the
    time, because of labelling/unlabelling ports via semanage.

Fix description:
    Skip labelling and unlabelling if special environment
    variables are present: DS_SKIP_LABEL and DS_SKIP_UNLABEL
    respectively.

https://fedorahosted.org/389/ticket/48953

Reviewed by: [email protected] (Thanks!)
Viktor Ashirov 9 years ago
parent
commit
e9ae515f6f
1 changed files with 2 additions and 2 deletions
  1. 2 2
      ldap/admin/src/scripts/DSCreate.pm.in

+ 2 - 2
ldap/admin/src/scripts/DSCreate.pm.in

@@ -1039,7 +1039,7 @@ sub updateSelinuxPolicy {
 
         # label the selected port as ldap_port_t
         # We should be doing this for secure port too .....
-        if ($inf->{slapd}->{ServerPort} != 0) {
+        if ($inf->{slapd}->{ServerPort} != 0 and not $ENV{DS_SKIP_LABEL}) {
             my $port_query_cmd = ("$inf->{slapd}->{sbindir}/ds_selinux_port_query $inf->{slapd}->{ServerPort} ldap_port_t 2> $mydevnull");
             my $need_label = 0;
             my $result = system($port_query_cmd);
@@ -1462,7 +1462,7 @@ sub removeDSInstance {
 
     # remove the selinux label from the ports if needed
     my $mydevnull = (-c "/dev/null" ? " /dev/null " : " NUL ");
-    if ((getLogin() eq 'root') and "@with_selinux@" and system("@sbindir@/ds_selinux_enabled") == 256 ) {
+    if ((getLogin() eq 'root') and "@with_selinux@" and system("@sbindir@/ds_selinux_enabled") == 256 and not $ENV{DS_SKIP_UNLABEL}) {
         foreach my $port (@{$entry->{"nsslapd-port"}}) 
         {