Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Julien Ledoux
lemonldap-ng
Commits
6cbdc45e
Commit
6cbdc45e
authored
Oct 15, 2018
by
Clément OUDOT
Browse files
Check if keys exist before deleting it in the HASH (#1520)
parent
2bbabb66
Changes
1
Hide whitespace changes
Inline
Side-by-side
lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Cli.pm
View file @
6cbdc45e
...
...
@@ -137,17 +137,44 @@ sub delKey {
foreach
my
$el
(
@list
)
{
my
@path
=
split
$sep
,
$el
->
[
0
];
if
(
$#path
==
0
)
{
delete
$new
->
{
$path
[
0
]
}
->
{
$el
->
[
1
]
};
if
(
exists
$new
->
{
$path
[
0
]
}
&&
exists
$new
->
{
$path
[
0
]
}
->
{
$el
->
[
1
]
}
)
{
delete
$new
->
{
$path
[
0
]
}
->
{
$el
->
[
1
]
}
if
exists
$new
->
{
$path
[
0
]
}
->
{
$el
->
[
1
]
};
}
}
elsif
(
$#path
==
1
)
{
delete
$new
->
{
$path
[
0
]
}
->
{
$path
[
1
]
}
->
{
$el
->
[
1
]
};
if
(
exists
$new
->
{
$path
[
0
]
}
&&
exists
$new
->
{
$path
[
0
]
}
->
{
$path
[
1
]
}
&&
exists
$new
->
{
$path
[
0
]
}
->
{
$path
[
1
]
}
->
{
$el
->
[
1
]
}
)
{
delete
$new
->
{
$path
[
0
]
}
->
{
$path
[
1
]
}
->
{
$el
->
[
1
]
};
}
}
elsif
(
$#path
==
2
)
{
delete
$new
->
{
$path
[
0
]
}
->
{
$path
[
1
]
}
->
{
$path
[
2
]
}
->
{
$el
->
[
1
]
};
if
(
exists
$new
->
{
$path
[
0
]
}
&&
exists
$new
->
{
$path
[
0
]
}
->
{
$path
[
1
]
}
&&
exists
$new
->
{
$path
[
0
]
}
->
{
$path
[
1
]
}
->
{
$path
[
2
]
}
&&
exists
$new
->
{
$path
[
0
]
}
->
{
$path
[
1
]
}
->
{
$path
[
2
]
}
->
{
$el
->
[
1
]
}
)
{
delete
$new
->
{
$path
[
0
]
}
->
{
$path
[
1
]
}
->
{
$path
[
2
]
}
->
{
$el
->
[
1
]
};
}
}
elsif
(
$#path
==
3
)
{
delete
$new
->
{
$path
[
0
]
}
->
{
$path
[
1
]
}
->
{
$path
[
2
]
}
->
{
$path
[
3
]
}
->
{
$el
->
[
1
]
};
if
(
exists
$new
->
{
$path
[
0
]
}
&&
exists
$new
->
{
$path
[
0
]
}
->
{
$path
[
1
]
}
&&
exists
$new
->
{
$path
[
0
]
}
->
{
$path
[
1
]
}
->
{
$path
[
2
]
}
&&
exists
$new
->
{
$path
[
0
]
}
->
{
$path
[
1
]
}
->
{
$path
[
2
]
}
->
{
$path
[
3
]
}
&&
exists
$new
->
{
$path
[
0
]
}
->
{
$path
[
1
]
}
->
{
$path
[
2
]
}
->
{
$path
[
3
]
}
->
{
$el
->
[
1
]
}
)
{
delete
$new
->
{
$path
[
0
]
}
->
{
$path
[
1
]
}
->
{
$path
[
2
]
}
->
{
$path
[
3
]
}
->
{
$el
->
[
1
]
};
}
}
else
{
die
$el
->
[
0
]
.
"
has too many levels. Aborting
";
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment