Skip to content
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

Fixes #3274 : Add migration script to add "All nodes" group #21

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions rudder-webapp/SOURCES/rudder-upgrade
Expand Up @@ -66,6 +66,7 @@ set -e
# - 2.5.0 : Migration DB schema to add gitcommit table, to link a git commit to a modification
# - 2.5.0 : Migration DB schema to add modificationid column to eventLog table
# - 2.5.0 : Update logback.xml in order to have information about non compliant reports
# - 2.6.0 : Migration LDAP : Add "All Nodes" Group
#####################################################################################

# Some variables
Expand Down Expand Up @@ -411,6 +412,17 @@ ruleTarget: special:all
EOF
fi


## Add group "All-Nodes"
## Check if the group "All-Nodes" exists
CHECK_ALLNODES_GROUP=`/opt/rudder/bin/ldapsearch -H ldap://localhost -x -w ${LDAP_PASSWORD} -D ${LDAP_USER} -b "groupCategoryId=GroupRoot,ou=Rudder,cn=rudder-configuration" -LLL "(nodeGroupId=All-Nodes)" | wc -l`
if [ ${LDAP_EXISTS} -ne 0 -a ${CHECK_ALLNODES_GROUP} -eq 0 ]
then
echo "Create node group \"All-Nodes\" dn:nodeGroupId=All-Nodes,groupCategoryId=GroupRoot,ou=Rudder,cn=rudder-configuration"
/opt/rudder/bin/ldapmodify -x -D ${LDAP_USER} -w ${LDAP_PASSWORD} -H ldap://localhost -f ${RUDDER_UPGRADE_TOOLS}/ldapMigration-2.5-2.6-Add-all-Nodes-Group.ldif
fi


# Migrate from old policy-template store in /var/rudder/configuration-repository/policy-templates
# to 2.4.0 in /var/rudder/configuration-repository/techniques
if [ -d /var/rudder/configuration-repository/policy-templates -a ! -d /var/rudder/configuration-repository/techniques ]; then
Expand Down
1 change: 1 addition & 0 deletions rudder-webapp/SPECS/rudder-webapp.spec
Expand Up @@ -168,6 +168,7 @@ cp %{_sourcedir}/rudder-sources/rudder/rudder-core/src/main/resources/Migration/
cp %{_sourcedir}/rudder-sources/rudder/rudder-core/src/main/resources/Migration/dbMigration-2.4-2.5-last-error-report-id.sql %{buildroot}%{rudderdir}/share/upgrade-tools/
cp %{_sourcedir}/rudder-sources/rudder/rudder-core/src/main/resources/Migration/dbMigration-2.4-2.5-git-commit.sql %{buildroot}%{rudderdir}/share/upgrade-tools/
cp %{_sourcedir}/rudder-sources/rudder/rudder-core/src/main/resources/Migration/dbMigration-2.4-2.5-add-modification-id-to-EventLog.sql %{buildroot}%{rudderdir}/share/upgrade-tools/
cp %{_sourcedir}/rudder-sources/rudder/rudder-core/src/main/resources/Migration/ldapMigration-2.5-2.6-Add-all-Nodes-Group.ldif %{buildroot}%{rudderdir}/share/upgrade-tools/
cp %{_sourcedir}/rudder-upgrade-LDAP-schema-2.3-2.4-add-entries.ldif %{buildroot}%{rudderdir}/share/upgrade-tools/

cp %{SOURCE5} %{buildroot}%{rudderdir}/bin/
Expand Down
1 change: 1 addition & 0 deletions rudder-webapp/debian/rules
Expand Up @@ -96,6 +96,7 @@ binary-arch: install
dh_install --SOURCEDIR=$(CURDIR)/SOURCES/rudder-sources/rudder/rudder-core/src/main/resources/Migration/ dbMigration-2.4-2.5-last-error-report-id.sql /opt/rudder/share/upgrade-tools/
dh_install --SOURCEDIR=$(CURDIR)/SOURCES/rudder-sources/rudder/rudder-core/src/main/resources/Migration/ dbMigration-2.4-2.5-git-commit.sql /opt/rudder/share/upgrade-tools/
dh_install --SOURCEDIR=$(CURDIR)/SOURCES/rudder-sources/rudder/rudder-core/src/main/resources/Migration/ dbMigration-2.4-2.5-add-modification-id-to-EventLog.sql /opt/rudder/share/upgrade-tools/
dh_install --SOURCEDIR=$(CURDIR)/SOURCES/rudder-sources/rudder/rudder-core/src/main/resources/Migration/ ldapMigration-2.5-2.6-Add-all-Nodes-Group.ldif /opt/rudder/share/upgrade-tools/
dh_install --SOURCEDIR=$(CURDIR)/SOURCES/ rudder-upgrade-LDAP-schema-2.3-2.4-add-entries.ldif /opt/rudder/share/upgrade-tools/

dh_install --SOURCEDIR=$(CURDIR)/SOURCES/ rudder-upgrade /opt/rudder/bin/
Expand Down