Robert,
thanks a lot for your input. so i changed the script slightly according your comments.
If Changes are not saved, i am sending a "mgmt_cli discard".
Moved the mgmt login and logout, so there should no orphaned sessions occur again.
to 2. this group object is used. The network objects created by the script are directly added into this group.
mgmt_cli add group name "$v_grp" color "$v_objcolor" comments "$v_objcomment" -s id.txt
.
.
.
awk -v awk_grp="$v_grp" -v awk_opfx="$v_objprefix" -v awk_color="$v_objcolor" -v awk_comment="$v_objcomment" 'FNR==NR { a[FNR""] = $0; next } { print "mgmt_cli -s id.txt add network name \""awk_opfx""a[FNR""]"\" ",$0" color \""awk_color"\" groups.1 \""awk_grp"\" comments \""awk_comment"\""}' $v_diff_add $v_diff_add_netmask >$v_diff_add_sh
If the group exists, i just got the error :
code: "err_validation_failed"
message: "Validation failed with 1 error"
errors:
- message: "More than one object named 'ge_o365-networks' exists."
This was one of the parts, i think the script is ugly
So, I added a condition to check if the group exists and only to send the "mgmt_cli add group name" if not. So the message above should not occur again.
again - thanks. You helped me a lot!
Cheers,
Daniel