When an alias have the same domain name of site (eg. www.example.com), it isn't added to DNS zone.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Thomas Bosviel’s picture

Status: Active » Needs review
FileSize
2.23 KB

This patch add/delete CNAME records to DNS zone.

anarcat’s picture

Status: Needs review » Needs work

Committed.

However, I believe we should also add records for aliases on different zones - if they are allowed by the frontend, they should just be allowed in. Can you rework the patch for that?

Thomas Bosviel’s picture

I'll see what I can do. We should add records for alias only if zones already exist and are managed by Aegir or we should create new zones ?

anarcat’s picture

I think we can create new zones.

Thomas Bosviel’s picture

I tried to add records for aliases on different zones with this code :
$this->config('zone', $zone_alias)->record_set($sub_alias, array('A' => $ips));

Even if the variable $zone_alias reflect a different zone name, records are always added in the zone of website. I tried to disable the cache for zone config with no result. I could generate a different zone by changing the context with d(@server_master) but this command causes many problems.

My knowledge of the inner workings of Provision is too limited to be carried out this work. I publish my work here if someone wants to continue.

anarcat’s picture

Version: » 6.x-1.0-rc7
Status: Needs work » Needs review

tbosviel - can you review your own patch and commit it? :P we're heading towards 1.0 here... worst case, it will end up in 1.1.

For me, the patch looks good - but I haven't tested it. And there seems to be some debugging code in there, or at least that drush_log() message should be translatable (dt())...

Thomas Bosviel’s picture

Status: Needs review » Needs work
Issue tags: +alias, +dns

Patch reviewed and committed in development branch dev-dns_alias_records-1074966.

I have tested the patch with the install of example.com with 3 aliases : www.example.com, example.fr and www.example.fr. We should have two zone files but there is only one, example.com. You can see the files generated:

"config/dns.d/example.com.zone.inc"

$record[''] = array (
  'A' =>
  array (
    '@server_master' => '172.16.206.129',
  ),
);
$record['@'] = array (
  'A' =>
  array (
    '@server_master' => '172.16.206.129',
  ),
  'SOA' =>
  array (
    'serial' => '2011041301',
  ),
);
$record['www'] = array (
  'CNAME' =>
  array (
    0 => 'example.com.',
  ),
  'A' =>
  array (
    '@server_master' => '172.16.206.129',
  ),
);

"config/server_master/bind/zone.d/example.com.zone"

; Bind zonefile
; File managed by Aegir
; Changes here may be lost by user configurations, tread carefully
$TTL 86400
@     IN     SOA  ubuntu admin.ubuntu.localdomain (
                  2011041301 ; serial
                  21600; refresh
                  3600 ; retry
                  604800 ; expire
                  86400 ; minimum
          )
@   IN  NS  ubuntu. ; primary DNS
@   IN  NS  debian.localdomain. ; slave DNS
@   IN  A   172.16.206.129
    IN  A   172.16.206.129
www IN  CNAME   example.com.
www IN  A   172.16.206.129

You can see that all aliases are stored in the same file, even if provision shows creating example.com zone and creating example.fr zone.

Thomas Bosviel’s picture

Status: Needs work » Needs review

I changed the behavior of the function config() of provisionService class to store multiple instances of provisionConfig_dns_zone and manage multiple zone files.
--
http://drupalcode.org/project/provision.git/commit/8834a5543f007f12f60ef...

anarcat’s picture

I am not sure I like the idea of hashing the serialized data, but I'm not familiar with the code here.

By the way, if this is merged, I believe it should be merged only in 2.x, because it looks like an API change to me (is that right?)...

http://community.aegirproject.org/discuss/2x-branch-created

Thomas Bosviel’s picture

Yes it's an API change. Even if I was careful to not break other services officially maintained, services developed by third parties may have problems in two cases.

Configuration classes are registered like this:

$this->configs['server'][] = 'provisionConfig_example';
$this->configs['server'][] = 'provisionConfig_example2';

Before the last instance was returned, now this is the first.

Service uses the data parameter of the function config() several times in the same script: before the function returns the same instance, the function now returns two different instances.

izmeez’s picture

subscribing

anarcat’s picture

I wonder if this bug isn't related to #1184172: failing on "serial number overflow"?

ergonlogic’s picture

Version: 6.x-1.0-rc7 » 7.x-3.x-dev
Status: Needs review » Needs work

This will definitely need some testing at a minimum. Also, bumping version.

ergonlogic’s picture

This will definitely need some testing at a minimum. Also, bumping version.

ergonlogic’s picture

This will definitely need some testing at a minimum. Also, bumping version.

anarcat’s picture

Component: Code » DNS Service

yes

yes

yes ;)

ergonlogic’s picture

oops, that's weird. sorry about the triple post.

  • Commit 5e8329b on 6.x-1.x, dev-ssl-ip-allocation-refactor, dev-1205458-move_sites_out_of_platforms, 7.x-3.x, dev-subdir-multiserver, 6.x-2.x-backports, dev-helmo-3.x by anarcat:
    #1074966 by tbosviel - add aliases to the zone
    
    we do not add aliases to...
  • Commit 897f29f on 6.x-1.x, dev-ssl-ip-allocation-refactor, dev-1205458-move_sites_out_of_platforms, 7.x-3.x, dev-subdir-multiserver, 6.x-2.x-backports, dev-helmo-3.x by Thomas Bosviel:
    Issue #1074966: fix warning in command line mode.
    
    
  • Commit 589bcc2 on debian, dev-ssl-ip-allocation-refactor, dev-1205458-move_sites_out_of_platforms, 7.x-3.x, dev-subdir-multiserver, 6.x-2.x-backports, dev-helmo-3.x authored by Thomas Bosviel, committed by anarcat:
    Issue #1074966: fix warning in command line mode.
    
    

  • anarcat committed 5e8329b on 7.x-3.x-1966886-context-to-entity
    #1074966 by tbosviel - add aliases to the zone
    
    we do not add aliases to...
  • Thomas Bosviel committed 897f29f on 7.x-3.x-1966886-context-to-entity
    Issue #1074966: fix warning in command line mode.
    
    
  • anarcat committed 589bcc2 on 7.x-3.x-1966886-context-to-entity authored by Thomas Bosviel
    Issue #1074966: fix warning in command line mode.
    
    

  • anarcat committed 5e8329b on 6.x-2.x-1995506-profile-option
    #1074966 by tbosviel - add aliases to the zone
    
    we do not add aliases to...
  • Thomas Bosviel committed 897f29f on 6.x-2.x-1995506-profile-option
    Issue #1074966: fix warning in command line mode.
    
    
  • anarcat committed 589bcc2 on 6.x-2.x-1995506-profile-option authored by Thomas Bosviel
    Issue #1074966: fix warning in command line mode.
    
    

  • anarcat committed 5e8329b on 2358795-provision-save-on-verify
    #1074966 by tbosviel - add aliases to the zone
    
    we do not add aliases to...
  • Thomas Bosviel committed 897f29f on 2358795-provision-save-on-verify
    Issue #1074966: fix warning in command line mode.
    
    
  • anarcat committed 589bcc2 on 2358795-provision-save-on-verify authored by Thomas Bosviel
    Issue #1074966: fix warning in command line mode.
    
    

  • anarcat committed 5e8329b on 7.x-4.x
    #1074966 by tbosviel - add aliases to the zone
    
    we do not add aliases to...
  • Thomas Bosviel committed 897f29f on 7.x-4.x
    Issue #1074966: fix warning in command line mode.
    
    
  • anarcat committed 589bcc2 on 7.x-4.x authored by Thomas Bosviel
    Issue #1074966: fix warning in command line mode.
    
    
Neograph734’s picture

Project: Provision » Hosting DNS
Version: 7.x-3.x-dev »
Component: DNS Service » Code
Issue summary: View changes
Issue tags: -alias, -dns

Moving this to the Hosting DNS module as discussed in #2466989: Spin off DNS extension.

Is this still an issue, or has this been fixed with above commits?

Neograph734’s picture

Version: » 7.x-3.x-dev
Status: Needs work » Fixed

The new system makes sure aliases are properly added.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.