@@ -101,14 +101,18 @@ protected override void ExecuteCommand()
101
101
private List < T > GetVMContextList < T > ( string serviceName , NSM . DeploymentGetResponse deployment )
102
102
where T : PVM . PersistentVMRoleContext , new ( )
103
103
{
104
- var vmRoles = new List < NSM . Role > ( deployment . Roles . Where (
105
- r => string . IsNullOrEmpty ( Name )
106
- || r . RoleName . Equals ( Name , StringComparison . InvariantCultureIgnoreCase ) ) ) ;
104
+ Func < NSM . Role , bool > typeMatched =
105
+ r => string . Equals ( r . RoleType , PersistentVMRoleStr , StringComparison . OrdinalIgnoreCase ) ;
107
106
108
- return GetVMContextList < T > ( serviceName , deployment , vmRoles ) ;
107
+ Func < NSM . Role , bool > nameMatched =
108
+ r => string . IsNullOrEmpty ( this . Name ) || r . RoleName . Equals ( this . Name , StringComparison . InvariantCultureIgnoreCase ) ;
109
+
110
+ var vmRoles = new List < NSM . Role > ( deployment . Roles . Where ( r => typeMatched ( r ) && nameMatched ( r ) ) ) ;
111
+
112
+ return CreateVMContextList < T > ( serviceName , deployment , vmRoles ) ;
109
113
}
110
114
111
- private List < T > GetVMContextList < T > ( string serviceName , NSM . DeploymentGetResponse deployment , List < NSM . Role > vmRoles )
115
+ private List < T > CreateVMContextList < T > ( string serviceName , NSM . DeploymentGetResponse deployment , List < NSM . Role > vmRoles )
112
116
where T : PVM . PersistentVMRoleContext , new ( )
113
117
{
114
118
var roleContexts = new List < T > ( ) ;
0 commit comments