Skip to main content
Skip table of contents

Python cookbook: adding a UNIX host

This topic describes the process of adding a UNIX host using the delphixpy Python API.

Within Delphix, there are both hosts and host environments. A host represents a remote system, but may or may not be a source or target for linking or provisioning. For example, in an Oracle RAC cluster, the cluster environment represents the location of the Oracle installation(s), and while there are hosts within that cluster they are not individually manageable as environments.

Procedure

  1. Create new environment creation parameters and initialize the structure for a UNIX host.

    ActionScript

    CODE
    
    from delphixpy.web.vo import HostEnvironmentCreateParameters, UnixHostEnvironment, UnixHostCreateParameters, UnixHost, EnvironmentUser, PasswordCredentialhost_environment_create_parameters_vo = HostEnvironmentCreateParameters()host_environment_create_parameters_vo.host_environment = UnixHostEnvironment()host_environment_create_parameters_vo.host_parameters = UnixHostCreateParameters()host_environment_create_parameters_vo.host_parameters.host = UnixHost()host_environment_create_parameters_vo.primary_user = EnvironmentUser()host_environment_create_parameters_vo.primary_user.credential = PasswordCredential()
  2. Set the host address and port. The name of the environment is derived from the address used, though you can provide a more descriptive name if desired. The address can be a DNS names, IP addresses, or a comma separated list of the above.

    ActionScript

    CODE
    
    host_environment_create_parameters_vo.host_parameters.host.addresses = ["192.168.1.2"]host_environment_create_parameters_vo.host_parameters.host.port = 22
  3. Set the toolkit path. This is where Delphix will store temporary binaries used while the host is configured as part of Delphix.

    ActionScript

    CODE
    
    host_environment_create_parameters_vo.host_parameters.host.toolkit_path = "/var/delphix"
  4. Set the username and password to use when connecting over SSH. This user must have the privileges described in the Delphix Administration Guide. To configure a SSH user, change the credential object to SystemKeyCredential.

    ActionScript

    CODE
    
    host_environment_create_parameters_vo.primary_user.name = "oracle"host_environment_create_parameters_vo.primary_user.credential.password = "my secret password"
  5. Commit the result. A reference to your new environment will be returned from the create call. The environment discovery process will execute as an asynchronous job. The default behavior is to wait for the result, so progress will be updated until the discovery process is complete or fails.

    ActionScript

    CODE
    
    from delphixpy.delphix_server import DelphixServerfrom delphixpy.web import environmentserver = DelphixServer("delphix-address", "delphix-user", "delphix-password", "DOMAIN")new_environment_reference = environment.create(server, host_environment_create_parameters_vo)
  6. Full example

    ActionScript

    CODE
    
    from delphixpy.delphix_server import DelphixServerfrom delphixpy.web import environmentfrom delphixpy.web.vo import HostEnvironmentCreateParameters, UnixHostEnvironment, UnixHostCreateParameters, UnixHost, EnvironmentUser, PasswordCredentialhost_environment_create_parameters_vo = HostEnvironmentCreateParameters()host_environment_create_parameters_vo.host_environment = UnixHostEnvironment()host_environment_create_parameters_vo.host_parameters = UnixHostCreateParameters()host_environment_create_parameters_vo.host_parameters.host = UnixHost()host_environment_create_parameters_vo.primary_user = EnvironmentUser()host_environment_create_parameters_vo.primary_user.credential = PasswordCredential()host_environment_create_parameters_vo.host_parameters.host.addresses = ["192.168.1.2"]host_environment_create_parameters_vo.host_parameters.host.port = 22host_environment_create_parameters_vo.host_parameters.host.toolkit_path = "/var/delphix"host_environment_create_parameters_vo.primary_user.name = "oracle"host_environment_create_parameters_vo.primary_user.credential.password = "my secret password"server = DelphixServer("delphix-address", "delphix-user", "delphix-password", "DOMAIN")new_environment_reference = environment.create(server, host_environment_create_parameters_vo)
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.