Skip to content

Commit

Permalink
Fixing wok_log redundancy and i18n.py error messages
Browse files Browse the repository at this point in the history
This patch removes wok_log calls when they are just
reproducing the same message of a call to a wok.exception
(NotFoundError, OperationFailed ...) class. Wok exceptions
already write the messages into the log and calling
wok_log is redundant.

Any other use of wok_log was preserved (logging a message
that didn't appear to the user, for example).

i18n.py messages were fixed along the way (wrong use of
message strings, typos, etc).

Files affected: model/nfsshares.py,
model/nw_cfginterfaces_utils.py, model/ovsbridges.py,
model/physical_vol.py

Signed-off-by: Daniel Henrique Barboza <[email protected]>
  • Loading branch information
danielhb committed Jul 14, 2016
1 parent aea7709 commit 6811742
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 147 deletions.
98 changes: 42 additions & 56 deletions i18n.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,11 @@
"GINNET0010E": _("Unable to delete default gateway: %(err)s"),
"GINNET0011E": _("Unable to set default gateway: %(err)s"),
"GINNET0014E": _("%(name)s is not valid network interface"),
"GINNET0015E": _("Error getting information from ifcfg file: "
"'%(error)s'."),
"GINNET0016E": _("Unable to activate the interface on '%(name)s', "
"'%(error)s'."),
"GINNET0017E": _("Unable to deactivate the interface on '%(name)s', "
"'%(error)s'."),
"GINNET0018E": _("Invalid ipv4 address '%(ip)s', "
"'%(error)s'."),
"GINNET0019E": _("Invalid prefix '%(PREFIX)s', "
"'%(error)s'."),
"GINNET0015E": _("Error getting information from ifcfg file: '%(error)s'."),
"GINNET0016E": _("Unable to activate the interface on '%(name)s', '%(error)s'."),
"GINNET0017E": _("Unable to deactivate the interface on '%(name)s', '%(error)s'."),
"GINNET0018E": _("Invalid ipv4 address '%(ip)s', '%(error)s'."),
"GINNET0019E": _("Invalid prefix '%(PREFIX)s', '%(error)s'."),
"GINNET0020E": _("IP address is missing."),
"GINNET0021E": _("PREFIX missing."),
"GINNET0022E": _("Invalid boot protocol '%(mode)s', "),
Expand All @@ -52,50 +47,41 @@
"GINNET0025E": _("Device name of interface is missing or invalid."),
"GINNET0026E": _("Missing ipv4 initialization key."),
"GINNET0027E": _("Missing ipv6 initialization key."),
"GINNET0028E": _("Invalid ipv6 address '%(ip)s', "
"'%(error)s'."),
"GINNET0029E": _("Missing ipv6 address information"),
"GINNET0028E": _("Invalid ipv6 address '%(ip)s', '%(error)s'."),
"GINNET0029E": _("Missing ipv6 address information."),
"GINNET0030E": _("Exception getting route information: %(err)s"),
"GINNET0032E": _("Bond info is missing"),
"GINNET0032E": _("Bond info is missing."),
"GINNET0033E": _("Allowed values for BONDING_MASTER are 'yes' or 'no'"),
"GINNET0034E": _("Bonding master is missing"),
"GINNET0036E": _("Slave(s) is missing"),
"GINNET0037E": _("Minimum one slave has to be given for the bond "
"interface"),
"GINNET0038E": _("Type is missing"),
"GINNET0040E": _("Invalid bonding option parameter"),
"GINNET0041E": _("'yes' or 'no' is allowed value for the VLAN"),
"GINNET0042E": _("Vlan info is missing"),
"GINNET0043E": _("Vlan is missing"),
"GINNET0044E": _("Vlan id is missing"),
"GINNET0045E": _("Physical device name is missing"),
"GINNET0046E": _("A VLAN slave cannot be configured on a bond with the "
"fail_over_mac=follow option"),
"GINNET0047E": _("For vlan creation over bond, slaves has to be up"),
"GINNET0048E": _("Module 802q is not loaded into kernel"),
"GINNET0034E": _("Bonding master is missing."),
"GINNET0036E": _("Slave(s) is missing."),
"GINNET0037E": _("Minimum one slave has to be given for the bond interface."),
"GINNET0038E": _("Type is missing."),
"GINNET0040E": _("Invalid bonding option parameter."),
"GINNET0041E": _("'yes' or 'no' are the allowed values for the VLAN."),
"GINNET0042E": _("Vlan info is missing."),
"GINNET0043E": _("Vlan is missing."),
"GINNET0044E": _("Vlan id is missing."),
"GINNET0045E": _("Physical device name is missing."),
"GINNET0046E": _("A VLAN slave cannot be configured on a bond with the fail_over_mac=follow option."),
"GINNET0047E": _("For vlan creation over bond, slaves has to be up."),
"GINNET0048E": _("Module 802q is not loaded into kernel."),
"GINNET0049E": _("Failed to delete ifcfg file, Error: '%(error)s'"),
"GINNET0050E": _("VLAN id exceeds the ranges from '0' to '4095'"),
"GINNET0051E": _("Parent interface of type 'Bond' is not active"),
"GINNET0052E": _("Type is unknown"),
"GINNET0053E": _("Persistent file for slave '%(slave)s' is missing"),
"GINNET0055E": _("Interface '%(name)s' is neither Vlan nor "
"Bond to perform delete operation"),
"GINNET0056E": _("Failed to identify the type of interface"),
"GINNET0057E": _("Persistent file is not available for an interface, "
"'%(name)s'"),
"GINNET0058E": _("Failed to a delete token from ifcfg file, Error: "
"'%(error)s'"),
"GINNET0059E": _("Unable to bring up the interface '%(name)s', "
"'%(error)s'."),
"GINNET0060E": _("Unable to bring down the interface '%(name)s', "
"'%(error)s'."),
"GINNET0061E": _("Missing IPV4 addresses information"),
"GINNET0062E": _("The prefix value %(PREFIX)s is not in range 1-32"),
"GINNET0063E": _("Exception updating the interface settings"),
"GINNET0050E": _("VLAN id exceeds the ranges from '0' to '4095'."),
"GINNET0051E": _("Parent interface of type 'Bond' is not active."),
"GINNET0052E": _("Type is unknown."),
"GINNET0053E": _("Persistent file for slave '%(slave)s' is missing."),
"GINNET0055E": _("Interface '%(name)s' is neither Vlan nor Bond to perform delete operation."),
"GINNET0056E": _("Failed to identify the type of interface."),
"GINNET0057E": _("Persistent file is not available for an interface, '%(name)s'."),
"GINNET0058E": _("Failed to a delete token from ifcfg file, Error: '%(error)s'."),
"GINNET0059E": _("Unable to bring up the interface '%(name)s', '%(error)s'."),
"GINNET0060E": _("Unable to bring down the interface '%(name)s', '%(error)s'."),
"GINNET0061E": _("Missing IPV4 addresses information."),
"GINNET0062E": _("The prefix value %(PREFIX)s is not in range 1-32."),
"GINNET0063E": _("Exception updating the interface settings: %(err)s"),
"GINNET0064E": _("Boot protocol is missing for ipv6 settings."),
"GINNET0065E": _("The prefix value %(PREFIX)s is not in range 1-128"),
"GINNET0066E": _("Given vlan id is not an integer type, Error: '%("
"error)s'"),
"GINNET0065E": _("The prefix value %(PREFIX)s is not in range 1-128."),
"GINNET0066E": _("Given vlan id is not an integer type, Error: '%(error)s'."),
"GINNET0067E": _("Maximum length of device name is 15 characters only."),
"GINNET0068E": _("Device name is invalid."),
"GINNET0070E": _("Gateway information is missing."),
Expand Down Expand Up @@ -260,10 +246,10 @@
"GINLVM0002E": _("Error executing 'lvm version' command. %(err)s"),
"GINLVM0003E": _("Incompatible output from 'lvm version' command. %(err)s"),

"GINPV00001E": _("Required pv_name parameter"),
"GINPV00002E": _("Failed to create PV"),
"GINPV00003E": _("Failed to fetch PV list"),
"GINPV00004E": _("Failed to fetch PV details"),
"GINPV00001E": _("Required pv_name parameter."),
"GINPV00002E": _("Failed to create PV %(name)s."),
"GINPV00003E": _("Failed to fetch PV list. Error: %(err)s"),
"GINPV00004E": _("Failed to fetch PV %(name)s details."),
"GINPV00005E": _("Failed to delete PV, error: %(err)s"),
"GINPV00006E": _("pvs command failed"),
"GINPV00007E": _("Unable to get information of device %(dev)s, error: %(err)s"),
Expand Down Expand Up @@ -353,8 +339,8 @@
"GINSERV00002E": _("Service name %(name)s not found."),
"GINSTG00001E": _("Invalid URI, please use /stgserver/%(ipaddr)s/nfsshares"),
"GINSTG00002E": _("Invalid URI, no list of storage servers available"),
"GINNFS00001E": _("Error fetching NFS shares"),
"GINNFS00002E": _("Invalid server or no NFS exports found on server"),
"GINNFS00001E": _("Error fetching NFS shares for server %(name)s."),
"GINNFS00002E": _("Invalid server or no NFS exports found on server."),

# These messages (ending with L) are for user log purposes
"GINDASD0001L": _("Formatted DASD device '%(ident)s' with block size %(blk_size)s"),
Expand Down
6 changes: 2 additions & 4 deletions model/nfsshares.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import fs_utils
from wok.exception import NotFoundError, OperationFailed
from wok.utils import patch_find_nfs_target, wok_log
from wok.utils import patch_find_nfs_target


class NFSSharesModel(object):
Expand All @@ -44,6 +44,4 @@ def get_list(self, model_args):
return {'NFSShares': sharepoints}

except ValueError:
wok_log.error("Error fetching NFS shares "
"for server %s" % name)
raise OperationFailed("GINNFS00001E")
raise OperationFailed("GINNFS00001E", {'name': name})
Loading

0 comments on commit 6811742

Please sign in to comment.