summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSheldon Sandbekkhaug <sheldon.sandbekkhaug@calxeda.com>2013-07-02 13:31:27 -0500
committerSheldon Sandbekkhaug <sheldon.sandbekkhaug@calxeda.com>2013-07-02 13:31:27 -0500
commit8e2094df262777677e413d51562e2a5710f35d06 (patch)
tree31643a0579efaa86978dfeea0c2ed056bf700964
parentefa1e0d95070194eae6ce7e1979d4f8805cc0620 (diff)
downloadcxmanage-8e2094df262777677e413d51562e2a5710f35d06.tar.gz
(CXMAN-203) Firmware Update Logs
node.py Logs are now saved to: ~/.cxmanage/logs/<node.ip_address>/<timestamp>-fwupdate.log Removed arguments to update_firmware() (formerly needed for the old way of saving logs) Removed a logger.info() stating the time (every message states the time) fw.py Removed unneeded arguments to the call to update_firmware()
-rw-r--r--cxmanage/commands/fw.py17
-rw-r--r--cxmanage_api/node.py16
2 files changed, 10 insertions, 23 deletions
diff --git a/cxmanage/commands/fw.py b/cxmanage/commands/fw.py
index 1495c2a..99ed4fe 100644
--- a/cxmanage/commands/fw.py
+++ b/cxmanage/commands/fw.py
@@ -29,10 +29,6 @@
# DAMAGE.
-import os
-import sys
-import time
-
from pkg_resources import parse_version
from cxmanage import get_tftp, get_nodes, get_node_strings, run_command, \
@@ -59,19 +55,8 @@ def fwupdate_command(args):
if not args.quiet:
print "Updating firmware..."
- # Create a directory for the firmware update logs
- timestamp = time.strftime("%Y%m%d%H%M%S")
- dir_name = "fwupdate_fabric_%s_" % nodes[0].ip_address
- dir_name = dir_name + timestamp
- dir_path = os.path.expanduser(os.path.join("~/", ".cxmanage", dir_name))
-
- if not os.path.exists(dir_path):
- os.makedirs(dir_path)
-
- args.dir_path = dir_path
-
results, errors = run_command(args, nodes, "update_firmware", package,
- args.dir_path, args.partition, args.priority)
+ args.partition, args.priority)
if errors:
print "ERROR: Firmware update failed."
return True
diff --git a/cxmanage_api/node.py b/cxmanage_api/node.py
index d4d997d..d951c86 100644
--- a/cxmanage_api/node.py
+++ b/cxmanage_api/node.py
@@ -581,7 +581,7 @@ class Node(object):
NoPartitionError, ImageSizeError, PartitionInUseError):
return False
- def update_firmware(self, package, save_to, partition_arg="INACTIVE",
+ def update_firmware(self, package, partition_arg="INACTIVE",
priority=None):
""" Update firmware on this target.
@@ -593,8 +593,6 @@ class Node(object):
:param package: Firmware package to deploy.
:type package: `FirmwarePackage <firmware_package.html>`_
- :param save_to: Path to the directory logs should be saved to
- :type save_to: string
:param partition_arg: Partition to upgrade to.
:type partition_arg: string
@@ -606,16 +604,20 @@ class Node(object):
num_ubootenv_partitions = len([x for x in fwinfo
if "UBOOTENV" in x.type])
-
- new_filename = "node%d_fwupdate.log" % self.node_id
- new_filepath = os.path.join(save_to, new_filename)
+ new_directory = "~/.cxmanage/logs/%s" % self.ip_address
+ new_directory = os.path.expanduser(new_directory)
+ if not os.path.exists(new_directory):
+ os.makedirs(new_directory)
+
+ timestamp = time.strftime("%Y%m%d%H%M%S")
+ new_filename = "%s-fwupdate.log" % timestamp
+ new_filepath = os.path.join(new_directory, new_filename)
logger = loggers.FileLogger(new_filepath)
logger.info(
"Firmware Update Log for Node %d" % self.node_id
)
- logger.info(time.strftime("%m/%d/%Y %H:%M:%S"))
logger.info("ECME IP address: " + self.ip_address)
version_info = self.get_versions()