@@ -795,7 +795,7 @@ public Model.CompilationJob StartCompilationJob(string resourceGroupName, string
795
795
#endregion
796
796
797
797
#region node configuration
798
- public Model . NodeConfiguration GetNodeConfiguration ( string resourceGroupName , string automationAccountName , string nodeConfigurationName )
798
+ public Model . NodeConfiguration GetNodeConfiguration ( string resourceGroupName , string automationAccountName , string nodeConfigurationName , string rollupStatus )
799
799
{
800
800
using ( var request = new RequestSettings ( this . automationManagementClient ) )
801
801
{
@@ -806,11 +806,26 @@ public Model.NodeConfiguration GetNodeConfiguration(string resourceGroupName, st
806
806
string . Format ( CultureInfo . CurrentCulture , Resources . NodeConfigurationNotFound , nodeConfigurationName ) ) ;
807
807
}
808
808
809
- return new Model . NodeConfiguration ( automationAccountName , nodeConfiguration ) ;
809
+ string computedRollupStatus = "Good" ;
810
+ var nodes = this . ListDscNodesByNodeConfiguration ( resourceGroupName , automationAccountName , nodeConfigurationName , null ) ;
811
+ foreach ( var node in nodes )
812
+ {
813
+ if ( node . Status . Equals ( "Not Compliant" ) || node . Status . Equals ( "Failed" ) || node . Status . Equals ( "Unresponsive" ) )
814
+ {
815
+ computedRollupStatus = "Bad" ;
816
+ }
817
+ }
818
+
819
+ if ( string . IsNullOrEmpty ( rollupStatus ) || ( rollupStatus != null && computedRollupStatus . Equals ( rollupStatus ) ) )
820
+ {
821
+ return new Model . NodeConfiguration ( automationAccountName , nodeConfiguration , computedRollupStatus ) ;
822
+ }
823
+
824
+ return null ;
810
825
}
811
826
}
812
827
813
- public IEnumerable < Model . NodeConfiguration > ListNodeConfigurationsByConfigurationName ( string resourceGroupName , string automationAccountName , string configurationName )
828
+ public IEnumerable < Model . NodeConfiguration > ListNodeConfigurationsByConfigurationName ( string resourceGroupName , string automationAccountName , string configurationName , string rollupStatus )
814
829
{
815
830
using ( var request = new RequestSettings ( this . automationManagementClient ) )
816
831
{
@@ -829,12 +844,13 @@ public Model.NodeConfiguration GetNodeConfiguration(string resourceGroupName, st
829
844
return new ResponseWithSkipToken < AutomationManagement . Models . DscNodeConfiguration > ( response , response . DscNodeConfigurations ) ;
830
845
} ) ;
831
846
847
+ string computedRollUpStatus = "Good" ;
832
848
833
- return nodeConfigModels . Select ( nodeConfigModel => new Commands . Automation . Model . NodeConfiguration ( automationAccountName , nodeConfigModel ) ) ;
849
+ return nodeConfigModels . Select ( nodeConfigModel => new Commands . Automation . Model . NodeConfiguration ( automationAccountName , nodeConfigModel , computedRollUpStatus ) ) ;
834
850
}
835
851
}
836
852
837
- public IEnumerable < Model . NodeConfiguration > ListNodeConfigurations ( string resourceGroupName , string automationAccountName )
853
+ public IEnumerable < Model . NodeConfiguration > ListNodeConfigurations ( string resourceGroupName , string automationAccountName , string rollupStatus )
838
854
{
839
855
using ( var request = new RequestSettings ( this . automationManagementClient ) )
840
856
{
@@ -851,8 +867,26 @@ public Model.NodeConfiguration GetNodeConfiguration(string resourceGroupName, st
851
867
return new ResponseWithSkipToken < AutomationManagement . Models . DscNodeConfiguration > ( response , response . DscNodeConfigurations ) ;
852
868
} ) ;
853
869
870
+ var nodeConfigurations = new List < Model . NodeConfiguration > ( ) ;
871
+ foreach ( var nodeConfiguration in nodeConfigModels )
872
+ {
873
+ string computedRollupStatus = "Good" ;
874
+ var configName = nodeConfiguration . Configuration != null ? nodeConfiguration . Configuration . Name : null ;
875
+ var nodes = this . ListDscNodesByNodeConfiguration ( resourceGroupName , automationAccountName , configName , null ) ;
876
+ foreach ( var node in nodes )
877
+ {
878
+ if ( node . Status . Equals ( "Not Compliant" ) || node . Status . Equals ( "Failed" ) || node . Status . Equals ( "Unresponsive" ) )
879
+ {
880
+ computedRollupStatus = "Bad" ;
881
+ }
882
+ }
883
+ if ( string . IsNullOrEmpty ( rollupStatus ) || ( rollupStatus != null && computedRollupStatus . Equals ( rollupStatus ) ) )
884
+ {
885
+ nodeConfigurations . Add ( new Model . NodeConfiguration ( automationAccountName , nodeConfiguration , computedRollupStatus ) ) ;
886
+ }
887
+ }
854
888
855
- return nodeConfigModels . Select ( nodeConfigModel => new Model . NodeConfiguration ( automationAccountName , nodeConfigModel ) ) ;
889
+ return nodeConfigurations . AsEnumerable < Model . NodeConfiguration > ( ) ;
856
890
}
857
891
}
858
892
0 commit comments