|
Lines 735-744
Link Here
|
| 735 |
if not ignore_exists: |
735 |
if not ignore_exists: |
| 736 |
out.append('E: No free IP address found') |
736 |
out.append('E: No free IP address found') |
| 737 |
return out + ['OPERATION FAILED'] |
737 |
return out + ['OPERATION FAILED'] |
| 738 |
except univention.admin.uexceptions.valueInvalidSyntax, err: |
738 |
except univention.admin.uexceptions.valueInvalidSyntax as err: |
| 739 |
out.append('E: Invalid Syntax: %s' % err) |
739 |
out.append('E: Invalid Syntax: %s' % err) |
| 740 |
return out + ["OPERATION FAILED"] |
740 |
return out + ["OPERATION FAILED"] |
| 741 |
except Exception, err: |
741 |
except Exception as err: |
| 742 |
out.append('E: Option %s is not valid' % err) |
742 |
out.append('E: Option %s is not valid' % err) |
| 743 |
return out + ['OPERATION FAILED'] |
743 |
return out + ['OPERATION FAILED'] |
| 744 |
|
744 |
|
|
Lines 746-759
Link Here
|
| 746 |
exists_msg = None |
746 |
exists_msg = None |
| 747 |
try: |
747 |
try: |
| 748 |
dn = object.create() |
748 |
dn = object.create() |
| 749 |
except univention.admin.uexceptions.objectExists, dn: |
749 |
except univention.admin.uexceptions.objectExists as exc: |
| 750 |
exists_msg = dn |
750 |
exists_msg = '%s' % (exc,) |
|
|
751 |
dn = exc.args[0] |
| 751 |
if not ignore_exists: |
752 |
if not ignore_exists: |
| 752 |
out.append('E: Object exists: %s' % exists_msg) |
753 |
out.append('E: Object exists: %s' % exists_msg) |
| 753 |
return out + ["OPERATION FAILED"] |
754 |
return out + ["OPERATION FAILED"] |
| 754 |
else: |
755 |
else: |
| 755 |
exists = 1 |
756 |
exists = 1 |
| 756 |
except univention.admin.uexceptions.uidAlreadyUsed, user: |
757 |
except univention.admin.uexceptions.uidAlreadyUsed as user: |
| 757 |
exists_msg = '(uid) %s' % user |
758 |
exists_msg = '(uid) %s' % user |
| 758 |
if not ignore_exists: |
759 |
if not ignore_exists: |
| 759 |
out.append('E: Object exists: %s' % exists_msg) |
760 |
out.append('E: Object exists: %s' % exists_msg) |
|
Lines 760-766
Link Here
|
| 760 |
return out + ["OPERATION FAILED"] |
761 |
return out + ["OPERATION FAILED"] |
| 761 |
else: |
762 |
else: |
| 762 |
exists = 1 |
763 |
exists = 1 |
| 763 |
except univention.admin.uexceptions.groupNameAlreadyUsed, group: |
764 |
except univention.admin.uexceptions.groupNameAlreadyUsed as group: |
| 764 |
exists_msg = '(group) %s' % group |
765 |
exists_msg = '(group) %s' % group |
| 765 |
if not ignore_exists: |
766 |
if not ignore_exists: |
| 766 |
out.append('E: Object exists: %s' % exists_msg) |
767 |
out.append('E: Object exists: %s' % exists_msg) |
|
Lines 767-773
Link Here
|
| 767 |
return out + ["OPERATION FAILED"] |
768 |
return out + ["OPERATION FAILED"] |
| 768 |
else: |
769 |
else: |
| 769 |
exists = 1 |
770 |
exists = 1 |
| 770 |
except univention.admin.uexceptions.dhcpServerAlreadyUsed, name: |
771 |
except univention.admin.uexceptions.dhcpServerAlreadyUsed as name: |
| 771 |
exists_msg = '(dhcpserver) %s' % name |
772 |
exists_msg = '(dhcpserver) %s' % name |
| 772 |
if not ignore_exists: |
773 |
if not ignore_exists: |
| 773 |
out.append('E: Object exists: %s' % exists_msg) |
774 |
out.append('E: Object exists: %s' % exists_msg) |
|
Lines 774-780
Link Here
|
| 774 |
return out + ["OPERATION FAILED"] |
775 |
return out + ["OPERATION FAILED"] |
| 775 |
else: |
776 |
else: |
| 776 |
exists = 1 |
777 |
exists = 1 |
| 777 |
except univention.admin.uexceptions.macAlreadyUsed, mac: |
778 |
except univention.admin.uexceptions.macAlreadyUsed as mac: |
| 778 |
exists_msg = '(mac) %s' % mac |
779 |
exists_msg = '(mac) %s' % mac |
| 779 |
if not ignore_exists: |
780 |
if not ignore_exists: |
| 780 |
out.append('E: Object exists: %s' % exists_msg) |
781 |
out.append('E: Object exists: %s' % exists_msg) |
|
Lines 781-788
Link Here
|
| 781 |
return out + ["OPERATION FAILED"] |
782 |
return out + ["OPERATION FAILED"] |
| 782 |
else: |
783 |
else: |
| 783 |
exists = 1 |
784 |
exists = 1 |
| 784 |
except univention.admin.uexceptions.noLock, e: |
785 |
except univention.admin.uexceptions.noLock as e: |
| 785 |
exists_msg = '(nolock) %s' % str(e) |
786 |
exists_msg = '(nolock) %s' % (e,) |
| 786 |
if not ignore_exists: |
787 |
if not ignore_exists: |
| 787 |
out.append('E: Object exists: %s' % exists_msg) |
788 |
out.append('E: Object exists: %s' % exists_msg) |
| 788 |
return out + ["OPERATION FAILED"] |
789 |
return out + ["OPERATION FAILED"] |
|
Lines 791-797
Link Here
|
| 791 |
except univention.admin.uexceptions.invalidDhcpEntry: |
792 |
except univention.admin.uexceptions.invalidDhcpEntry: |
| 792 |
out.append('E: The DHCP entry for this host should contain the zone dn, the ip address and the mac address.') |
793 |
out.append('E: The DHCP entry for this host should contain the zone dn, the ip address and the mac address.') |
| 793 |
return out + ["OPERATION FAILED"] |
794 |
return out + ["OPERATION FAILED"] |
| 794 |
except univention.admin.uexceptions.invalidOptions, e: |
795 |
except univention.admin.uexceptions.invalidOptions as e: |
| 795 |
if not ignore_exists: |
796 |
if not ignore_exists: |
| 796 |
out.append('E: invalid Options: %s' % e) |
797 |
out.append('E: invalid Options: %s' % e) |
| 797 |
return out + ["OPERATION FAILED"] |
798 |
return out + ["OPERATION FAILED"] |
|
Lines 798-811
Link Here
|
| 798 |
except univention.admin.uexceptions.insufficientInformation as exc: |
799 |
except univention.admin.uexceptions.insufficientInformation as exc: |
| 799 |
out.append('E: Insufficient information: %s' % (exc,)) |
800 |
out.append('E: Insufficient information: %s' % (exc,)) |
| 800 |
return out + ["OPERATION FAILED"] |
801 |
return out + ["OPERATION FAILED"] |
| 801 |
except univention.admin.uexceptions.noObject, e: |
802 |
except univention.admin.uexceptions.noObject as e: |
| 802 |
out.append('E: object not found: %s' % e) |
803 |
out.append('E: object not found: %s' % e) |
| 803 |
return out + ["OPERATION FAILED"] |
804 |
return out + ["OPERATION FAILED"] |
| 804 |
except univention.admin.uexceptions.circularGroupDependency, e: |
805 |
except univention.admin.uexceptions.circularGroupDependency as e: |
| 805 |
out.append('E: circular group dependency detected: %s' % e) |
806 |
out.append('E: circular group dependency detected: %s' % e) |
| 806 |
return out + ["OPERATION FAILED"] |
807 |
return out + ["OPERATION FAILED"] |
| 807 |
|
808 |
|
| 808 |
if policy_reference: |
809 |
if not exists and policy_reference: |
| 809 |
lo.modify(dn, [('objectClass', '', 'univentionPolicyReference')]) |
810 |
lo.modify(dn, [('objectClass', '', 'univentionPolicyReference')]) |
| 810 |
modlist = [] |
811 |
modlist = [] |
| 811 |
for el in policy_reference: |
812 |
for el in policy_reference: |