Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
fusiondirectory
fusiondirectory-plugins
Commits
8f1978c8
Verified
Commit
8f1978c8
authored
4 years ago
by
Côme Chilliet
Browse files
Options
Download
Patches
Plain Diff
fix(plugins) Adapt code to create_missing_trees error handling
issue
#6061
parent
92cc980a
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
dhcp/admin/dhcp/class_dhcpConfiguration.inc
+5
-1
dhcp/admin/dhcp/class_dhcpConfiguration.inc
fai/admin/systems/services/repository/class_serviceRepository.inc
+8
-6
...n/systems/services/repository/class_serviceRepository.inc
fusioninventory/html/collect.php
+5
-1
fusioninventory/html/collect.php
gpg/addons/gpg/class_pgpServerInfo.inc
+4
-9
gpg/addons/gpg/class_pgpServerInfo.inc
user-reminder/config/user-reminder/class_userReminderConfig.inc
+5
-1
...eminder/config/user-reminder/class_userReminderConfig.inc
with
27 additions
and
18 deletions
+27
-18
dhcp/admin/dhcp/class_dhcpConfiguration.inc
+
5
−
1
View file @
8f1978c8
...
@@ -131,7 +131,11 @@ class dhcpConfiguration extends simplePlugin
...
@@ -131,7 +131,11 @@ class dhcpConfiguration extends simplePlugin
/* Save dhcp settings */
/* Save dhcp settings */
$ldap
=
$config
->
get_ldap_link
();
$ldap
=
$config
->
get_ldap_link
();
$ldap
->
cd
(
$config
->
current
[
'BASE'
]);
$ldap
->
cd
(
$config
->
current
[
'BASE'
]);
$ldap
->
create_missing_trees
(
preg_replace
(
'/^[^,]+,/'
,
''
,
$this
->
dn
));
try
{
$ldap
->
create_missing_trees
(
preg_replace
(
'/^[^,]+,/'
,
''
,
$this
->
dn
));
}
catch
(
FusionDirectoryError
$error
)
{
return
[
$error
];
}
$cache
=
$this
->
attributesAccess
[
'dhcpSections'
]
->
getCache
();
$cache
=
$this
->
attributesAccess
[
'dhcpSections'
]
->
getCache
();
$errors
=
[];
$errors
=
[];
$new
=
(
$this
->
orig_dn
==
'new'
);
$new
=
(
$this
->
orig_dn
==
'new'
);
...
...
This diff is collapsed.
Click to expand it.
fai/admin/systems/services/repository/class_serviceRepository.inc
+
8
−
6
View file @
8f1978c8
...
@@ -235,9 +235,10 @@ class serviceRepository extends simpleService
...
@@ -235,9 +235,10 @@ class serviceRepository extends simpleService
$ldap
->
cat
(
$fai
,
[
'dn'
]);
$ldap
->
cat
(
$fai
,
[
'dn'
]);
if
(
!
$ldap
->
count
())
{
if
(
!
$ldap
->
count
())
{
$ldap
->
cd
(
$config
->
current
[
'BASE'
]);
$ldap
->
cd
(
$config
->
current
[
'BASE'
]);
$ldap
->
create_missing_trees
(
$fai
);
try
{
if
(
!
$ldap
->
success
())
{
$ldap
->
create_missing_trees
(
$fai
);
msg_dialog
::
display
(
_
(
'LDAP error'
),
msgPool
::
ldaperror
(
$ldap
->
get_error
(),
$fai
,
LDAP_ADD
,
get_class
()),
LDAP_ERROR
);
}
catch
(
FusionDirectoryError
$error
)
{
$error
->
display
();
return
;
return
;
}
}
}
}
...
@@ -252,9 +253,10 @@ class serviceRepository extends simpleService
...
@@ -252,9 +253,10 @@ class serviceRepository extends simpleService
// Add classes OUs
// Add classes OUs
foreach
([
'Script'
,
'Hook'
,
'Template'
,
'Variable'
,
'Profile'
,
'Package'
,
'Partition'
]
as
$type
)
{
foreach
([
'Script'
,
'Hook'
,
'Template'
,
'Variable'
,
'Profile'
,
'Package'
,
'Partition'
]
as
$type
)
{
$ldap
->
cd
(
$dn
);
$ldap
->
cd
(
$dn
);
$ldap
->
create_missing_trees
(
get_ou
(
'fai'
.
$type
.
'RDN'
)
.
$dn
);
try
{
if
(
!
$ldap
->
success
())
{
$ldap
->
create_missing_trees
(
get_ou
(
'fai'
.
$type
.
'RDN'
)
.
$dn
);
msg_dialog
::
display
(
_
(
'LDAP error'
),
msgPool
::
ldaperror
(
$ldap
->
get_error
(),
get_ou
(
'fai'
.
$type
.
'RDN'
)
.
$dn
,
LDAP_ADD
,
get_class
()),
LDAP_ERROR
);
}
catch
(
FusionDirectoryError
$error
)
{
$error
->
display
();
}
}
}
}
}
else
{
}
else
{
...
...
This diff is collapsed.
Click to expand it.
fusioninventory/html/collect.php
+
5
−
1
View file @
8f1978c8
...
@@ -114,7 +114,11 @@ if (preg_match('/QUERY>PROLOG<\/QUERY/', $xml)) {
...
@@ -114,7 +114,11 @@ if (preg_match('/QUERY>PROLOG<\/QUERY/', $xml)) {
}
else
{
}
else
{
/* Make sure branch is existing */
/* Make sure branch is existing */
$ldap
->
cd
(
$config
->
current
[
'BASE'
]);
$ldap
->
cd
(
$config
->
current
[
'BASE'
]);
$ldap
->
create_missing_trees
(
get_ou
(
'inventoryRDN'
)
.
$config
->
current
[
'BASE'
]);
try
{
$ldap
->
create_missing_trees
(
get_ou
(
'inventoryRDN'
)
.
$config
->
current
[
'BASE'
]);
}
catch
(
FusionDirectoryError
$error
)
{
returnError
(
$error
->
getMessage
());
}
}
}
/* Create root node */
/* Create root node */
$ldap
->
cd
(
$dn
);
$ldap
->
cd
(
$dn
);
...
...
This diff is collapsed.
Click to expand it.
gpg/addons/gpg/class_pgpServerInfo.inc
+
4
−
9
View file @
8f1978c8
...
@@ -95,15 +95,10 @@ class pgpServerInfo extends simplePlugin
...
@@ -95,15 +95,10 @@ class pgpServerInfo extends simplePlugin
if
(
!
$ldap
->
count
())
{
if
(
!
$ldap
->
count
())
{
@
DEBUG
(
DEBUG_TRACE
,
__LINE__
,
__FUNCTION__
,
__FILE__
,
$this
->
pgpBaseKeySpaceDN
,
"Creating branch"
);
@
DEBUG
(
DEBUG_TRACE
,
__LINE__
,
__FUNCTION__
,
__FILE__
,
$this
->
pgpBaseKeySpaceDN
,
"Creating branch"
);
$ldap
->
cd
(
$config
->
current
[
'BASE'
]);
$ldap
->
cd
(
$config
->
current
[
'BASE'
]);
$ldap
->
create_missing_trees
(
$this
->
pgpBaseKeySpaceDN
);
try
{
if
(
!
$ldap
->
success
())
{
$ldap
->
create_missing_trees
(
$this
->
pgpBaseKeySpaceDN
);
$errors
[]
=
new
SimplePluginLdapError
(
}
catch
(
FusionDirectoryError
$error
)
{
$this
,
$errors
[]
=
SimplePluginError
::
relocate
(
$this
,
$error
);
$this
->
pgpBaseKeySpaceDN
,
LDAP_ADD
,
$ldap
->
get_error
(),
$ldap
->
get_errno
()
);
}
}
}
}
/* Delete the old branch if empty */
/* Delete the old branch if empty */
...
...
This diff is collapsed.
Click to expand it.
user-reminder/config/user-reminder/class_userReminderConfig.inc
+
5
−
1
View file @
8f1978c8
...
@@ -203,7 +203,11 @@ class userReminderConfig extends simplePlugin
...
@@ -203,7 +203,11 @@ class userReminderConfig extends simplePlugin
global
$config
;
global
$config
;
$ldap
=
$config
->
get_ldap_link
();
$ldap
=
$config
->
get_ldap_link
();
$ldap
->
cd
(
$config
->
current
[
'BASE'
]);
$ldap
->
cd
(
$config
->
current
[
'BASE'
]);
$ldap
->
create_missing_trees
(
get_ou
(
'reminderTokenRDN'
)
.
get_ou
(
'fusiondirectoryRDN'
)
.
$config
->
current
[
'BASE'
]);
try
{
$ldap
->
create_missing_trees
(
get_ou
(
'reminderTokenRDN'
)
.
get_ou
(
'fusiondirectoryRDN'
)
.
$config
->
current
[
'BASE'
]);
}
catch
(
FusionDirectoryError
$error
)
{
$error
->
display
();
}
parent
::
post_save
();
parent
::
post_save
();
}
}
}
}
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets