
from senlin.common.i18n import _
from senlin.common import schema
from senlin.profiles import base


class DockerProfile(base.Profile):
    """Profile for a docker container."""

    KEYS = (
        CONTEXT, IMAGE, NAME, COMMAND,
    ) = (
        'context', 'image', 'name', 'command',
    )

    properties_schema = {
        CONTEXT: schema.Map(
            _('Customized security context for operationg containers.')
        ),
        IMAGE: schema.String(
            _('The image used to create a container')
        ),
        NAME: schema.String(
            _('The name of the container.')
        ),
        COMMAND: schema.String(
            _('The command to run when container is started.')
        ),
    }

    def __init__(self, type_name, name, **kwargs):
        super(DockerProfile, self).__init__(type_name, name, **kwargs)

        self._dockerclient = None


from senlin.common.i18n import _
from senlin.common import schema
from senlin.profiles import base


class DockerProfile(base.Profile):
    """Profile for a docker container."""

    KEYS = (
        CONTEXT, IMAGE, NAME, COMMAND, HOST_NODE, HOST_CLUSTER
    ) = (
        'context', 'image', 'name', 'command', 'host_node', 'host_cluster',
    )

    properties_schema = {
        CONTEXT: schema.Map(
            _('Customized security context for operationg containers.')
        ),
        IMAGE: schema.String(
            _('The image used to create a container')
        ),
        NAME: schema.String(
            _('The name of the container.')
        ),
        COMMAND: schema.String(
            _('The command to run when container is started.')
        ),
        HOST_NODE: schema.String(
            _('The node on which container will be launched.')
        ),
        HOST_CLUSTER: schema.String(
            _('The cluster on which container cluster will be launched.')
        ),
    }

    def __init__(self, type_name, name, **kwargs):
        super(DockerProfile, self).__init__(type_name, name, **kwargs)

        self._dockerclient = None

Add 'host_node' and 'host_cluster' properties to container profile
Add 'host_node' and 'host_cluster' properties to container profile

Add 'host_node' and 'host_cluster' properties to container profile,
in a container profile, either 'host_node' or 'host_cluster' will
be assigned a value for a container node creation or a container
cluster creation.

blueprint container-profile-support

Change-Id: Ief464375bf651ebe1770c3fcf0488f29b25a94f4

  
  from senlin.common.i18n import _
  from senlin.common import schema
  from senlin.profiles import base
  
  
  class DockerProfile(base.Profile):
      """Profile for a docker container."""
  
      KEYS = (
-         CONTEXT, IMAGE, NAME, COMMAND,
+         CONTEXT, IMAGE, NAME, COMMAND, HOST_NODE, HOST_CLUSTER
      ) = (
-         'context', 'image', 'name', 'command',
+         'context', 'image', 'name', 'command', 'host_node', 'host_cluster',
      )
  
      properties_schema = {
          CONTEXT: schema.Map(
              _('Customized security context for operationg containers.')
          ),
          IMAGE: schema.String(
              _('The image used to create a container')
          ),
          NAME: schema.String(
              _('The name of the container.')
          ),
          COMMAND: schema.String(
              _('The command to run when container is started.')
          ),
+         HOST_NODE: schema.String(
+             _('The node on which container will be launched.')
+         ),
+         HOST_CLUSTER: schema.String(
+             _('The cluster on which container cluster will be launched.')
+         ),
      }
  
      def __init__(self, type_name, name, **kwargs):
          super(DockerProfile, self).__init__(type_name, name, **kwargs)
  
          self._dockerclient = None
  
Add 'host_node' and 'host_cluster' properties to container profile
## Code Before:

from senlin.common.i18n import _
from senlin.common import schema
from senlin.profiles import base


class DockerProfile(base.Profile):
    """Profile for a docker container."""

    KEYS = (
        CONTEXT, IMAGE, NAME, COMMAND,
    ) = (
        'context', 'image', 'name', 'command',
    )

    properties_schema = {
        CONTEXT: schema.Map(
            _('Customized security context for operationg containers.')
        ),
        IMAGE: schema.String(
            _('The image used to create a container')
        ),
        NAME: schema.String(
            _('The name of the container.')
        ),
        COMMAND: schema.String(
            _('The command to run when container is started.')
        ),
    }

    def __init__(self, type_name, name, **kwargs):
        super(DockerProfile, self).__init__(type_name, name, **kwargs)

        self._dockerclient = None

## Instruction:
Add 'host_node' and 'host_cluster' properties to container profile
## Code After:

from senlin.common.i18n import _
from senlin.common import schema
from senlin.profiles import base


class DockerProfile(base.Profile):
    """Profile for a docker container."""

    KEYS = (
        CONTEXT, IMAGE, NAME, COMMAND, HOST_NODE, HOST_CLUSTER
    ) = (
        'context', 'image', 'name', 'command', 'host_node', 'host_cluster',
    )

    properties_schema = {
        CONTEXT: schema.Map(
            _('Customized security context for operationg containers.')
        ),
        IMAGE: schema.String(
            _('The image used to create a container')
        ),
        NAME: schema.String(
            _('The name of the container.')
        ),
        COMMAND: schema.String(
            _('The command to run when container is started.')
        ),
        HOST_NODE: schema.String(
            _('The node on which container will be launched.')
        ),
        HOST_CLUSTER: schema.String(
            _('The cluster on which container cluster will be launched.')
        ),
    }

    def __init__(self, type_name, name, **kwargs):
        super(DockerProfile, self).__init__(type_name, name, **kwargs)

        self._dockerclient = None
