Skip to content

Commit 2cd467b

Browse files
author
Juliya Smith
committed
Seperate state modifications to other function in args
1 parent 0d9ff4b commit 2cd467b

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

c42seceventcli/aed/args.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ def get_args():
2727
cli_args = vars(parser.parse_args())
2828
args = _union_cli_args_with_config_file_args(cli_args)
2929
args.cli_parser = parser
30+
args.initialize_args()
3031
args.verify_authority_arg()
3132
args.verify_username_arg()
3233
args.verify_destination_args()
@@ -99,6 +100,14 @@ def __init__(self):
99100
self.begin_date = AEDArgs._get_default_begin_date()
100101
self.end_date = AEDArgs._get_default_end_date()
101102

103+
def initialize_args(self):
104+
self.destination_type = self.destination_type.lower()
105+
try:
106+
self.destination_port = int(self.destination_port)
107+
except ValueError:
108+
msg = "Destination port '{0}' not a base 10 integer.".format(self.destination_port)
109+
self._raise_value_error(msg)
110+
102111
@staticmethod
103112
def _get_default_begin_date():
104113
default_begin_date = datetime.now() - timedelta(days=60)
@@ -118,18 +127,9 @@ def verify_username_arg(self):
118127
self._raise_value_error("Code42 username not provided.")
119128

120129
def verify_destination_args(self):
121-
self.destination_type = self.destination_type.lower()
122-
self._verify_destination_port()
123130
self._verify_stdout_destination()
124131
self._verify_server_destination()
125132

126-
def _verify_destination_port(self):
127-
try:
128-
self.destination_port = int(self.destination_port)
129-
except ValueError:
130-
msg = "Destination port '{0}' not a base 10 integer.".format(self.destination_port)
131-
self._raise_value_error(msg)
132-
133133
def _verify_stdout_destination(self):
134134
if self.destination_type == "stdout" and self.destination is not None:
135135
msg = (

0 commit comments

Comments
 (0)