@@ -16,14 +16,16 @@ def sourcecontrol_show_table_format(result):
1616
1717
1818def __get_sourcecontrolconfig_table_row (result ):
19- return OrderedDict ([
20- ('name' , result ['name' ]),
21- ('repositoryUrl' , result ['repositoryUrl' ]),
22- ('operatorName' , result ['operatorInstanceName' ]),
23- ('operatorNamespace' , result ['operatorNamespace' ]),
24- ('scope' , result ['operatorScope' ]),
25- ('provisioningState' , result ['provisioningState' ])
26- ])
19+ return OrderedDict (
20+ [
21+ ("name" , result ["name" ]),
22+ ("repositoryUrl" , result ["repositoryUrl" ]),
23+ ("operatorName" , result ["operatorInstanceName" ]),
24+ ("operatorNamespace" , result ["operatorNamespace" ]),
25+ ("scope" , result ["operatorScope" ]),
26+ ("provisioningState" , result ["provisioningState" ]),
27+ ]
28+ )
2729
2830
2931def fluxconfig_list_table_format (results ):
@@ -35,14 +37,16 @@ def fluxconfig_show_table_format(result):
3537
3638
3739def __get_fluxconfig_table_row (result ):
38- return OrderedDict ([
39- ('name' , result ['name' ]),
40- ('namespace' , result ['namespace' ]),
41- ('scope' , result ['scope' ]),
42- ('provisioningState' , result ['provisioningState' ]),
43- ('complianceState' , result ['complianceState' ]),
44- ('lastSourceSyncedAt' , result ['lastSourceSyncedAt' ]),
45- ])
40+ return OrderedDict (
41+ [
42+ ("namespace" , result ["namespace" ]),
43+ ("name" , result ["name" ]),
44+ ("scope" , result ["scope" ]),
45+ ("provisioningState" , result ["provisioningState" ]),
46+ ("complianceState" , result ["complianceState" ]),
47+ ("lastSourceSyncedAt" , result ["lastSourceSyncedAt" ]),
48+ ]
49+ )
4650
4751
4852def fluxconfig_kustomization_list_table_format (results ):
@@ -55,19 +59,21 @@ def fluxconfig_kustomization_show_table_format(results):
5559
5660def __get_fluxconfig_kustomization_table_row (key , value ):
5761 deps = []
58- for dep in value .get ('dependsOn' ) or []:
59- if dep .get ('kustomizationName' ):
60- deps .append (dep ['kustomizationName' ])
61-
62- return OrderedDict ([
63- ('name' , key ),
64- ('path' , value ['path' ]),
65- ('dependsOn' , ',' .join (deps )),
66- ('syncInterval' , format_duration (value ['syncIntervalInSeconds' ])),
67- ('timeout' , format_duration (value ['timeoutInSeconds' ])),
68- ('prune' , value ['prune' ]),
69- ('force' , value ['force' ])
70- ])
62+ for dep in value .get ("dependsOn" ) or []:
63+ if dep .get ("kustomizationName" ):
64+ deps .append (dep ["kustomizationName" ])
65+
66+ return OrderedDict (
67+ [
68+ ("name" , key ),
69+ ("path" , value ["path" ]),
70+ ("dependsOn" , "," .join (deps )),
71+ ("syncInterval" , format_duration (value ["syncIntervalInSeconds" ])),
72+ ("timeout" , format_duration (value ["timeoutInSeconds" ])),
73+ ("prune" , value ["prune" ]),
74+ ("force" , value ["force" ]),
75+ ]
76+ )
7177
7278
7379def fluxconfig_deployed_object_list_table_format (results ):
@@ -79,13 +85,19 @@ def fluxconfig_deployed_object_show_table_format(result):
7985
8086
8187def __get_fluxconfig_deployed_object_table_row (result ):
82- applied_by = 'None'
83- if result ['appliedBy' ]:
84- applied_by = result ['appliedBy' ]['namespace' ] + result ['appliedBy' ]['name' ]
85- return OrderedDict ([
86- ('kind' , result ['kind' ]),
87- ('name' , result ['name' ]),
88- ('namespace' , result ['namespace' ]),
89- ('complianceState' , result ['complianceState' ]),
90- ('appliedBy' , applied_by )
91- ])
88+ message = "None"
89+ for condition in result .get ("statusConditions" ) or []:
90+ if condition .get ("type" ) == "Ready" :
91+ message = condition .get ("message" )
92+ if len (message ) > 60 :
93+ message = message [:60 ] + "..."
94+ break
95+ return OrderedDict (
96+ [
97+ ("kind" , result ["kind" ]),
98+ ("namespace" , result ["namespace" ]),
99+ ("name" , result ["name" ]),
100+ ("complianceState" , result ["complianceState" ]),
101+ ("message" , message ),
102+ ]
103+ )
0 commit comments