Skip to content

Commit

Permalink
Solving #93 (#99)
Browse files Browse the repository at this point in the history
Replacing some `logger.error` with `logger.info`, this was a mistake, they were supposed to be info from the beginning
  • Loading branch information
gabrik committed Jun 12, 2019
1 parent 1e4ec04 commit c69e120
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion fos-plugins/constraint/constraint_plugin
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ class ConstraintNode(Plugin):
f.write(content)
f.flush()
f.close()
self.logger.error(
self.logger.info(
'store_file()', 'Stored: {} bytes'.format(len(content)))
return True

Expand Down
20 changes: 10 additions & 10 deletions fos-plugins/linux/linux_plugin
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,9 @@ class Linux(OSPlugin):
return True

def local_mgmt_address(self):
self.logger.error('local_mgmt_address()', 'Entering function...')
self.logger.info('local_mgmt_address()', 'Entering function...')
mgmt_intf = self.node_conf.get('agent').get('mgmt_interface')
self.logger.error('local_mgmt_address()', 'MGMT Interface is {}'.format(mgmt_intf))
self.logger.info('local_mgmt_address()', 'MGMT Interface is {}'.format(mgmt_intf))
matching_if = [x['inft_configuration'] for x in self.nw_devices if x['intf_name'] == mgmt_intf]
if len(matching_if) == 1:
if_conf = matching_if[0]
Expand All @@ -284,7 +284,7 @@ class Linux(OSPlugin):
return res

def checksum(self, file_path):
self.logger.error('checksum()', 'Calculating SHA256 of {}'.format(file_path))
self.logger.info('checksum()', 'Calculating SHA256 of {}'.format(file_path))
try:
m = hashlib.sha256()
with open(file_path, "rb") as f:
Expand Down Expand Up @@ -413,7 +413,7 @@ class Linux(OSPlugin):
self.logger.error('executeCommand()', 'Error: {}'.format(e))
res = {'error': 0}
except FileNotFoundError as e:
self.logger.error(
self.logger.debug(
'removeFile()', 'OS Plugin File Not Found {} so don\'t need to remove'.format(e.strerror))
res = ({'error': e.errno})
except:
Expand All @@ -424,10 +424,10 @@ class Linux(OSPlugin):

def file_exists(self, file_path):
try:
self.logger.error(
self.logger.info(
'file_exists()', 'Called for: {}'.format(file_path))
r = os.path.isfile(file_path)
self.logger.error('file_exists()', 'Result {}'.format(r))
self.logger.info('file_exists()', 'Result {}'.format(r))
res = {'result': r}
except TypeError as e:
self.logger.error('file_exists()', 'Error: {}'.format(e))
Expand All @@ -441,14 +441,14 @@ class Linux(OSPlugin):
def store_file(self, content, file_path, filename):
content = base64.b64decode(binascii.unhexlify(content)).decode('utf-8')
try:
self.logger.error(
self.logger.info(
'store_file()', 'Called for: {}/{}'.format(file_path, filename))
full_path = os.path.join(file_path, filename)
f = open(full_path, 'w')
f.write(content)
f.flush()
f.close()
self.logger.error(
self.logger.info(
'store_file()', 'Stored: {} bytes'.format(len(content)))
res = {'result': True}
except TypeError as e:
Expand Down Expand Up @@ -566,7 +566,7 @@ class Linux(OSPlugin):
def send_sig_int(self, pid):
if isinstance(pid, str):
pid = int(pid)
self.logger.error('send_sig_int()', 'OS SIGINT to {}'.format(pid))
self.logger.info('send_sig_int()', 'OS SIGINT to {}'.format(pid))
try:
if self.__check_if_pid_exists(pid) is False:
self.logger.error(
Expand All @@ -587,7 +587,7 @@ class Linux(OSPlugin):
def send_sig_kill(self, pid):
if isinstance(pid, str):
pid = int(pid)
self.logger.error('send_sig_int()', 'OS SIGKILL to {}'.format(pid))
self.logger.info('send_sig_int()', 'OS SIGKILL to {}'.format(pid))
try:
if self.__check_if_pid_exists(pid) is False:
self.logger.error(
Expand Down
6 changes: 3 additions & 3 deletions fos-plugins/windows/windows_plugin
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ class Windows(OSPlugin):

def file_exists(self, file_path):
try:
self.logger.error(
self.logger.info(
'file_exists()', 'Called for: {}'.format(file_path))
r = os.path.isfile(file_path)
self.logger.error('file_exists()', 'Result {}'.format(r))
Expand All @@ -291,14 +291,14 @@ class Windows(OSPlugin):
def store_file(self, content, file_path, filename):
content = base64.b64decode(binascii.unhexlify(content)).decode('utf-8')
try:
self.logger.error(
self.logger.info(
'store_file()', 'Called for: {}/{}'.format(file_path, filename))
full_path = os.path.join(file_path, filename)
f = open(full_path, 'w')
f.write(content)
f.flush()
f.close()
self.logger.error(
self.logger.info(
'store_file()', 'Stored: {} bytes'.format(len(content)))
res = {'result': True}
except TypeError as e:
Expand Down

0 comments on commit c69e120

Please sign in to comment.