{"action":"created","issue":{"url":"https://api.github.com/repos/wildfly/wildfly-maven-plugin/issues/12","labels_url":"https://api.github.com/repos/wildfly/wildfly-maven-plugin/issues/12/labels{/name}","comments_url":"https://api.github.com/repos/wildfly/wildfly-maven-plugin/issues/12/comments","events_url":"https://api.github.com/repos/wildfly/wildfly-maven-plugin/issues/12/events","html_url":"https://github.com/wildfly/wildfly-maven-plugin/issues/12","id":35148693,"number":12,"title":"Domain Deployment to server group fails if one server is stopped.","user":{"login":"jweberde","id":3398215,"avatar_url":"https://avatars.githubusercontent.com/u/3398215?v=3","gravatar_id":"","url":"https://api.github.com/users/jweberde","html_url":"https://github.com/jweberde","followers_url":"https://api.github.com/users/jweberde/followers","following_url":"https://api.github.com/users/jweberde/following{/other_user}","gists_url":"https://api.github.com/users/jweberde/gists{/gist_id}","starred_url":"https://api.github.com/users/jweberde/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jweberde/subscriptions","organizations_url":"https://api.github.com/users/jweberde/orgs","repos_url":"https://api.github.com/users/jweberde/repos","events_url":"https://api.github.com/users/jweberde/events{/privacy}","received_events_url":"https://api.github.com/users/jweberde/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2014-06-06T14:11:29Z","updated_at":"2015-05-18T21:44:34Z","closed_at":"2015-05-18T21:44:34Z","body":"In live environment it can be that you have started and stopped servers within a server group. (Peek Time Configuration, Dynamic RAM) ...\r\n\r\nDuring the validation of the domain deployment (org.wildfly.plugin.deployment.domain.DomainDeployment:199) the method should check, if each provided \"server-group\" has at least one server in ServerStatus.STARTED.\r\n\r\nWhat it currently does:\r\n1. check if servers are assigned to the server-group selected for deployment\r\n2. check if these servers are all started\r\n\r\nTherefore even if one server is started the method throws an DeploymentFailureException which is a different behavior compared to Management Console Deployments.\r\n\r\nIt is also possible that the error is within, \"client.getServerStatuses()\" according to the documentation: (org.jboss.as.controller.client.helpers.domain.impl.DomainClientImpl:145)\r\n\"Gets a list of all servers known to the domain, along with their current status. Servers associated with host controllers that are currently off line will not be included.\"\r\n\r\nThe actual implementation returns all available servers within the host configuration including on and offline servers. CLI also returns on and offline servers. So maybe the behavior has changed.\r\n\r\nSo where to fix?\r\n\r\nBest\r\n\r\nJens\r\n\r\norg.jboss.as.controller.client.helpers.domain.impl.DomainClientImpl:145\r\n```java\r\n    @Override\r\n    public Map<ServerIdentity, ServerStatus> getServerStatuses() {\r\n        Map<ServerIdentity, ServerStatus> result = new HashMap<ServerIdentity, ServerStatus>();\r\n        List<String> hosts = getHostControllerNames();\r\n        for (String host : hosts) {\r\n            Set<String> servers = getServerNames(host);\r\n            for (String server : servers) {\r\n                ModelNode address = new ModelNode();\r\n                address.add(\"host\", host);\r\n                address.add(\"server-config\", server);\r\n                String group = readAttribute(\"group\", address).asString();\r\n                ServerStatus status = Enum.valueOf(ServerStatus.class, readAttribute(\"status\", address).asString());\r\n                ServerIdentity id = new ServerIdentity(host, group, server);\r\n                result.put(id, status);\r\n            }\r\n\r\n        }\r\n        return result;\r\n    }\r\n```\r\norg.wildfly.plugin.deployment.domain.DomainDeployment:199\r\n```java\r\n    void validate() throws DeploymentFailureException {\r\n        final Map<ServerIdentity, ServerStatus> statuses = client.getServerStatuses();\r\n        // Check for NPE\r\n        final List<String> serverGroups = domain.getServerGroups();\r\n        for (String serverGroup : serverGroups) {\r\n            boolean notFound = true;\r\n            // Check the servers\r\n            for (ServerIdentity serverId : statuses.keySet()) {\r\n                if (serverGroup.equals(serverId.getServerGroupName())) {\r\n                    ServerStatus currentStatus = statuses.get(serverId);\r\n                    if (currentStatus != ServerStatus.STARTED) {\r\n                        throw new DeploymentFailureException(\"Status of server group '%s' is '%s', but is required to be '%s'.\",\r\n                                serverGroup, currentStatus, ServerStatus.STARTED);\r\n                    }\r\n                    notFound = false;\r\n                    break;\r\n                }\r\n            }\r\n            if (notFound) {\r\n                throw new DeploymentFailureException(\"Server group '%s' does not exist on the server.\", serverGroup);\r\n            }\r\n        }\r\n    }\r\n```"},"comment":{"url":"https://api.github.com/repos/wildfly/wildfly-maven-plugin/issues/comments/103221854","html_url":"https://github.com/wildfly/wildfly-maven-plugin/issues/12#issuecomment-103221854","issue_url":"https://api.github.com/repos/wildfly/wildfly-maven-plugin/issues/12","id":103221854,"user":{"login":"jamezp","id":420065,"avatar_url":"https://avatars.githubusercontent.com/u/420065?v=3","gravatar_id":"","url":"https://api.github.com/users/jamezp","html_url":"https://github.com/jamezp","followers_url":"https://api.github.com/users/jamezp/followers","following_url":"https://api.github.com/users/jamezp/following{/other_user}","gists_url":"https://api.github.com/users/jamezp/gists{/gist_id}","starred_url":"https://api.github.com/users/jamezp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamezp/subscriptions","organizations_url":"https://api.github.com/users/jamezp/orgs","repos_url":"https://api.github.com/users/jamezp/repos","events_url":"https://api.github.com/users/jamezp/events{/privacy}","received_events_url":"https://api.github.com/users/jamezp/received_events","type":"User","site_admin":false},"created_at":"2015-05-18T21:44:33Z","updated_at":"2015-05-18T21:44:33Z","body":"Moved to https://issues.jboss.org/browse/WFMP-4"}}