@@ -552,6 +552,7 @@ def get_status(self, force):
552
552
553
553
append_chassis_name = self .is_chassis_has_components ()
554
554
append_module_na = not self .is_modular_chassis ()
555
+ module_name = NA
555
556
556
557
for chassis_name , chassis_component_map in self .chassis_component_map .items ():
557
558
for chassis_component_name , chassis_component in chassis_component_map .items ():
@@ -565,17 +566,6 @@ def get_status(self, force):
565
566
status = self .FW_STATUS_UP_TO_DATE
566
567
info = NA
567
568
568
- if append_chassis_name :
569
- append_chassis_name = False
570
- else :
571
- chassis_name = EMPTY
572
-
573
- if append_module_na :
574
- module_name = NA
575
- append_module_na = False
576
- else :
577
- module_name = EMPTY
578
-
579
569
if component :
580
570
firmware_path = component [self .__pcp .FIRMWARE_KEY ]
581
571
firmware_version_available = component [self .__pcp .VERSION_KEY ]
@@ -590,8 +580,8 @@ def get_status(self, force):
590
580
591
581
status_table .append (
592
582
[
593
- chassis_name ,
594
- module_name ,
583
+ chassis_name if append_chassis_name else EMPTY ,
584
+ module_name if append_module_na else EMPTY ,
595
585
chassis_component_name ,
596
586
firmware_path ,
597
587
firmware_version ,
@@ -600,11 +590,19 @@ def get_status(self, force):
600
590
]
601
591
)
602
592
593
+ if append_chassis_name :
594
+ append_chassis_name = False
595
+
596
+ if append_module_na :
597
+ append_module_na = False
598
+
603
599
append_chassis_name = not self .is_chassis_has_components ()
600
+ chassis_name = self .chassis .get_name ()
604
601
605
602
if self .is_modular_chassis ():
606
603
for module_name , module_component_map in self .module_component_map .items ():
607
604
append_module_name = True
605
+
608
606
for module_component_name , module_component in module_component_map .items ():
609
607
component = self .__pcp .module_component_map [module_name ][module_component_name ]
610
608
@@ -616,17 +614,6 @@ def get_status(self, force):
616
614
status = self .FW_STATUS_UP_TO_DATE
617
615
info = NA
618
616
619
- if append_chassis_name :
620
- chassis_name = self .chassis .get_name ()
621
- append_chassis_name = False
622
- else :
623
- chassis_name = EMPTY
624
-
625
- if append_module_name :
626
- append_module_name = False
627
- else :
628
- module_name = EMPTY
629
-
630
617
if component :
631
618
firmware_path = component [self .__pcp .FIRMWARE_KEY ]
632
619
firmware_version_available = component [self .__pcp .VERSION_KEY ]
@@ -641,8 +628,8 @@ def get_status(self, force):
641
628
642
629
status_table .append (
643
630
[
644
- chassis_name ,
645
- module_name ,
631
+ chassis_name if append_chassis_name else EMPTY ,
632
+ module_name if append_module_name else EMPTY ,
646
633
module_component_name ,
647
634
firmware_path ,
648
635
firmware_version ,
@@ -651,13 +638,20 @@ def get_status(self, force):
651
638
]
652
639
)
653
640
641
+ if append_chassis_name :
642
+ append_chassis_name = False
643
+
644
+ if append_module_name :
645
+ append_module_name = False
646
+
654
647
return tabulate (status_table , self .STATUS_HEADER , tablefmt = self .FORMAT )
655
648
656
649
def update_firmware (self , force ):
657
650
status_table = [ ]
658
651
659
652
append_chassis_name = self .is_chassis_has_components ()
660
653
append_module_na = not self .is_modular_chassis ()
654
+ module_name = NA
661
655
662
656
for chassis_name , chassis_component_map in self .chassis_component_map .items ():
663
657
for chassis_component_name , chassis_component in chassis_component_map .items ():
@@ -672,17 +666,6 @@ def update_firmware(self, force):
672
666
673
667
status = self .FW_STATUS_UP_TO_DATE
674
668
675
- if append_chassis_name :
676
- append_chassis_name = False
677
- else :
678
- chassis_name = EMPTY
679
-
680
- if append_module_na :
681
- module_name = NA
682
- append_module_na = False
683
- else :
684
- module_name = EMPTY
685
-
686
669
if component :
687
670
firmware_path = component [self .__pcp .FIRMWARE_KEY ]
688
671
firmware_version_available = component [self .__pcp .VERSION_KEY ]
@@ -712,14 +695,21 @@ def update_firmware(self, force):
712
695
713
696
status_table .append (
714
697
[
715
- chassis_name ,
716
- module_name ,
698
+ chassis_name if append_chassis_name else EMPTY ,
699
+ module_name if append_module_na else EMPTY ,
717
700
chassis_component_name ,
718
701
status ,
719
702
]
720
703
)
721
704
705
+ if append_chassis_name :
706
+ append_chassis_name = False
707
+
708
+ if append_module_na :
709
+ append_module_na = False
710
+
722
711
append_chassis_name = not self .is_chassis_has_components ()
712
+ chassis_name = self .chassis .get_name ()
723
713
724
714
if self .is_modular_chassis ():
725
715
for module_name , module_component_map in self .module_component_map .items ():
@@ -738,17 +728,6 @@ def update_firmware(self, force):
738
728
739
729
status = self .FW_STATUS_UP_TO_DATE
740
730
741
- if append_chassis_name :
742
- chassis_name = self .chassis .get_name ()
743
- append_chassis_name = False
744
- else :
745
- chassis_name = EMPTY
746
-
747
- if append_module_name :
748
- append_module_name = False
749
- else :
750
- module_name = EMPTY
751
-
752
731
if component :
753
732
firmware_path = component [self .__pcp .FIRMWARE_KEY ]
754
733
firmware_version_available = component [self .__pcp .VERSION_KEY ]
@@ -778,13 +757,19 @@ def update_firmware(self, force):
778
757
779
758
status_table .append (
780
759
[
781
- chassis_name ,
782
- module_name ,
760
+ chassis_name if append_chassis_name else EMPTY ,
761
+ module_name if append_module_name else EMPTY ,
783
762
module_component_name ,
784
763
status ,
785
764
]
786
765
)
787
766
767
+ if append_chassis_name :
768
+ append_chassis_name = False
769
+
770
+ if append_module_name :
771
+ append_module_name = False
772
+
788
773
return tabulate (status_table , self .RESULT_HEADER , tablefmt = self .FORMAT )
789
774
790
775
@@ -803,34 +788,31 @@ def get_status(self):
803
788
804
789
append_chassis_name = self .is_chassis_has_components ()
805
790
append_module_na = not self .is_modular_chassis ()
791
+ module_name = NA
806
792
807
793
for chassis_name , chassis_component_map in self .chassis_component_map .items ():
808
794
for chassis_component_name , chassis_component in chassis_component_map .items ():
809
795
firmware_version = chassis_component .get_firmware_version ()
810
796
description = chassis_component .get_description ()
811
797
812
- if append_chassis_name :
813
- append_chassis_name = False
814
- else :
815
- chassis_name = EMPTY
816
-
817
- if append_module_na :
818
- module_name = NA
819
- append_module_na = False
820
- else :
821
- module_name = EMPTY
822
-
823
798
status_table .append (
824
799
[
825
- chassis_name ,
826
- module_name ,
800
+ chassis_name if append_chassis_name else EMPTY ,
801
+ module_name if append_module_na else EMPTY ,
827
802
chassis_component_name ,
828
803
firmware_version ,
829
804
description
830
805
]
831
806
)
832
807
808
+ if append_chassis_name :
809
+ append_chassis_name = False
810
+
811
+ if append_module_na :
812
+ append_module_na = False
813
+
833
814
append_chassis_name = not self .is_chassis_has_components ()
815
+ chassis_name = self .chassis .get_name ()
834
816
835
817
if self .is_modular_chassis ():
836
818
for module_name , module_component_map in self .module_component_map .items ():
@@ -840,25 +822,20 @@ def get_status(self):
840
822
firmware_version = module_component .get_firmware_version ()
841
823
description = module_component .get_description ()
842
824
843
- if append_chassis_name :
844
- chassis_name = self .chassis .get_name ()
845
- append_chassis_name = False
846
- else :
847
- chassis_name = EMPTY
848
-
849
- if append_module_name :
850
- append_module_name = False
851
- else :
852
- module_name = EMPTY
853
-
854
825
status_table .append (
855
826
[
856
- chassis_name ,
857
- module_name ,
827
+ chassis_name if append_chassis_name else EMPTY ,
828
+ module_name if append_module_name else EMPTY ,
858
829
module_component_name ,
859
830
firmware_version ,
860
831
description
861
832
]
862
833
)
863
834
835
+ if append_chassis_name :
836
+ append_chassis_name = False
837
+
838
+ if append_module_name :
839
+ append_module_name = False
840
+
864
841
return tabulate (status_table , self .HEADER , tablefmt = self .FORMAT )
0 commit comments