Migrate FusionDirectory from 1.0.4 to 1.0.5
===========================================

Clean FusionDirectory schema directory
--------------------------------------

**Debian**

.. code-block:: shell

   rm /etc/ldap/schema/fusiondirectory/*.ldif

Upgrade of LDAP directory
-------------------------

Install schema packages
^^^^^^^^^^^^^^^^^^^^^^^

Upgrade new schema core first:

**Debian**

.. code-block:: shell

   apt-get update
   apt-get install fusiondirectory-schema

Then, depending of your installation, install new schema packages for
your installed plugins.

For example, if you have Systems, Dhcp and Dns plugin installed, you
need to:

**Debian**

.. code-block:: shell

   apt-get install fusiondirectory-plugin-systems-schema
   apt-get install fusiondirectory-plugin-dhcp-schema
   apt-get install fusiondirectory-plugin-dns-schema

Remove old schema from your Ldap Directory
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Your installed schema are in /etc/ldap/slapd.d/cn\\=config/cn\\=schema
directory. For the above example, installed schema will be the
following:

**Debian**

.. code-block:: shell

   ldapsearch -Y EXTERNAL -H ldapi:/// -LLL -b cn=schema,cn=config \| grep "dn: cn={"

   SASL/EXTERNAL authentication started SASL username:
   gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth SASL SSF: 0 dn:
   cn={0}core,cn=schema,cn=config dn: cn={1}cosine,cn=schema,cn=config dn:
   cn={2}nis,cn=schema,cn=config dn:
   cn={3}inetorgperson,cn=schema,cn=config dn:
   cn={4}samba,cn=schema,cn=config dn: cn={5}gosystem,cn=schema,cn=config
   cn={6}gofon,cn=schema,cn=config dn: cn={7}gofax,cn=schema,cn=config
   cn={8}goto,cn=schema,cn=config dn:
   cn={9}goserver,cn=schema,cn=config dn:
   cn={10}goto-mime,cn=schema,cn=config dn:
   cn={11}gosa-samba3,cn=schema,cn=config dn:
   cn={12}ldapns,cn=schema,cn=config dn:
   cn={13}recovery,cn=schema,cn=config dn: cn={14}dhcp,cn=schema,cn=config
   cn={15}dnszone,cn=schema,cn=config

Schema's from 'cn={0}...' to 'cn={3}' doesn't change, so you can leave
it.

Now you need to remove all others before install the new one's. You can
start to remove before plugin schemas. Doing this is simple, just delete
its relative file in the folder

.. code-block:: shell

   /etc/ldap/slapd.d/cn=config/cn=schema
   
and restart slapd. A word of advice, remove schemas starting from the last. For the above
example:

**Debian**

.. code-block:: shell

   cd /etc/ldap/slapd.d/cn=config/cn=schema
   rm cn={15}dnszone.ldif
   rm cn={14}dhcp.ldif
   /etc/init.d/slapd stop
   /etc/init.d/slapd start

If everything goes right, you can remove core schemas:

**Debian**

.. code-block:: shell

   rm cn={13}recovery.ldif
   rm cn={12}ldapns.ldif
   rm cn={11}gosa-samba3.ldif
   rm cn={10}goto-mime.ldif
   rm cn={9}goserver.ldif
   rm cn={8}goto.ldif
   rm cn={7}gofax.ldif
   rm cn={6}gofon.ldif
   rm cn={5}gosystem.ldif
   rm cn={4}samba.ldif
   /etc/init.d/slapd stop
   /etc/init.d/slapd start

Insert new schemas inside your Ldap Directory
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

First of all insert the new core schemas:

**Debian**

.. code-block:: shell

   fusiondirectory-insert-schema

Then you can proceed for all the plugins schemas (here you can find a
`list of available plugins with old and new relative
schemas <en:documentation:admin_installation_schema_migration_1.0.5#list-of-available-plugin-with-relative-old-and-new-schemas>`__),
for the above example:

**Debian**

.. code-block:: shell

   fusiondirectory-insert-schema -i /etc/ldap/schema/fusiondirectory/service-fd.schema
   fusiondirectory-insert-schema -i /etc/ldap/schema/fusiondirectory/systems-fd-conf.schema
   fusiondirectory-insert-schema -i /etc/ldap/schema/fusiondirectory/mime-fd.schema
   fusiondirectory-insert-schema -i /etc/ldap/schema/fusiondirectory/systems-fd.schema
   fusiondirectory-insert-schema -i /etc/ldap/schema/fusiondirectory/dhcp-fd.schema
   fusiondirectory-insert-schema -i /etc/ldap/schema/fusiondirectory/dnszone.schema

Upgrade fusiondirectory first
-----------------------------

Upgrade FusionDirectory core package and fusiondirectory-plugin-systems
(if it's installed) before other ones to avoid dependencies errors:

**Debian**

.. code-block:: shell

   apt-get install fusiondirectory
   apt-get install fusiondirectory-plugin-systems
   apt-get upgrade

Configuration file is changed
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Starting with version 1.0.5, the configuration of FusionDirectory is
stored inside the ldap, in *configs* branch.

To adapt to this change, you need to Re-run setup.

Re-run setup
""""""""""""

Before you re-run the setup from the web interface, you must move your
old configuration file, doing this :

.. code-block:: shell

   mv /etc/fusiondirectory/fusiondirectory.conf /etc/fusiondirectory/fusiondirectory.conf.back

Then, in your web browser, you can type :

http://your_server/fusiondirectory/setup.php

and fill the required informations (look here to see more about
`parameters of
configuration <en:documentation:admin_installation:core_configuration>`__).

Possible problems and related solutions
---------------------------------------

Below you will find some migration issues, grouped by plugin, with their
solutions.

FAI plugin
^^^^^^^^^^

Before save modifications in a Server, look (inside your ldap directory)
if there is an objectClass FAI like this one, associated at this Server:

.. code-block:: shell

   objectClass: FAIobject

if you don't find any other FAI attribute for this Server, you need to
remove the above mentioned objectClass, in order to avoid automatic
generation of FAI attributes in related entry. This happens because
'objectClass: FAIobject' means that FAI tab for the related server is
activated.

Mail plugin
^^^^^^^^^^^

unrecognized objectClass 'goMailServer'
"""""""""""""""""""""""""""""""""""""""

If you get an error like this :

.. code-block:: shell

   LDAP operation failed!

   Object: cn=mailserver.fusiondirectory.org,ou=servers,ou=systems,dc=fusiondirectory,dc=org

   Error: Object class violation (unrecognized objectClass 'goMailServer', while operating on 'cn=mailserver.fusiondirectory.org,ou=servers,ou=systems,dc=fusiondirectory,dc=org' using LDAP server 'ldap://localhost:389')

this means that in your related ldap entry you have an objectClass like
this :

.. code-block:: shell

   objectClass: goMailServer

you need to modify this one to :

.. code-block:: shell

   objectClass: fdPostfixServer

Undefined attribute type - attribute: flag_enable_debug
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""

If you get an error like this :

.. code-block:: shell

   LDAP operation failed!

   Object: cn=mailserver.fusiondirectory.org,ou=servers,ou=systems,dc=fusiondirectory,dc=org

   Error: Undefined attribute type - attribute: flag_enable_debug
   (flag_enable_debug: AttributeDescription contains inappropriate characters, while operating on 'cn=mailserver.fusiondirectory.org,ou=servers,ou=systems,dc=fusiondirectory,dc=org' using LDAP server 'ldap://localhost:389')

this means that in your related ldap entry you have an attribute like
this :

.. code-block:: shell

   avFlags: DS

you need to remove this attribute.
