Example #1
0
 def test_is_provider_configured_no_driver(self):
     '''
     Tests when provider driver is not in opts
     '''
     opts = {'providers': {'foo': 'baz'}}
     provider = 'foo:bar'
     self.assertFalse(sconfig.is_provider_configured(opts, provider))
Example #2
0
 def test_is_provider_configured_no_alias(self):
     '''
     Tests when provider alias is not in opts
     '''
     opts = {'providers': 'test'}
     provider = 'foo:bar'
     self.assertFalse(sconfig.is_provider_configured(opts, provider))
Example #3
0
 def test_is_provider_configured_multiple_driver_not_provider(self):
     '''
     Tests when the drive is not the same as the provider when
     searching through multiple providers
     '''
     opts = {'providers': {'foo': {'bar': {'api_key': 'baz'}}}}
     provider = 'foo'
     self.assertFalse(sconfig.is_provider_configured(opts, provider))
Example #4
0
def get_configured_provider():
    ''' Return the first configured instance.
    '''
    return config.is_provider_configured(
        __opts__,
        __active_provider_name__ or __virtualname__,
        ('token',)
    )
Example #5
0
def get_configured_provider():
    '''
    Return the first configured instance.
    '''
    return config.is_provider_configured(
        __opts__,
        __active_provider_name__ or 'pyrax'
    )
Example #6
0
def get_configured_provider():
    '''
    Return the first configured instance.
    '''
    return config.is_provider_configured(
        __opts__,
        __active_provider_name__ or 'aws',
        ('id', 'key', 'keyname', 'securitygroup', 'private_key')
    )
def get_configured_provider():
    '''
    Return the first configured instance.
    '''
    return config.is_provider_configured(
        __opts__,
        __active_provider_name__ or 'digital_ocean',
        ('api_key',)
    )
Example #8
0
def get_configured_provider():
    '''
    Return the first configured instance.
    '''
    return config.is_provider_configured(
        __opts__,
        __active_provider_name__ or __virtualname__,
        ('subscription_id', 'certificate_path',)
    )
Example #9
0
File: nova.py Project: Anbcorp/salt
def get_configured_provider():
    '''
    Return the first configured instance.
    '''
    return config.is_provider_configured(
        __opts__,
        __active_provider_name__ or 'nova',
        ('auth_minion',)
    )
Example #10
0
def get_configured_provider():
    '''
    Return the first configured instance.
    '''
    return config.is_provider_configured(
        __opts__,
        __active_provider_name__ or __virtualname__,
        ('access_key_id', 'secret_access_key', 'zone', 'key_filename')
    )
Example #11
0
def get_configured_provider():
    '''
    Return the first configured instance.
    '''
    return config.is_provider_configured(
        __opts__,
        __active_provider_name__ or 'aliyun',
        ('id', 'key')
    )
Example #12
0
File: nova.py Project: mahak/salt
def get_configured_provider():
    '''
    Return the first configured instance.
    '''
    return config.is_provider_configured(
        __opts__,
        __active_provider_name__ or __virtualname__,
        ('user', 'tenant', 'identity_url', 'compute_region',)
    )
Example #13
0
def get_configured_provider():
    '''
    Return the first configured instance.
    '''
    return config.is_provider_configured(
        __opts__,
        __active_provider_name__ or __virtualname__,
        ('username', 'password', 'datacenter_id')
    )
Example #14
0
def get_configured_provider():
    '''
    Return the first configured instance.
    '''
    return config.is_provider_configured(
        __opts__,
        __active_provider_name__ or 'ibmsce',
        ('user', 'password')
    )
def get_configured_provider():
    '''
    Return the first configured instance.
    '''
    return config.is_provider_configured(
        __opts__,
        __active_provider_name__ or 'opennebula',
        ('xml_rpc', 'user', 'password')
    )
Example #16
0
def get_configured_provider():
    '''
    Return the first configured instance.
    '''
    return config.is_provider_configured(
        __opts__,
        __active_provider_name__ or 'rackspace',
        ('user', 'apikey')
    )
Example #17
0
def get_configured_provider():
    '''
    Return the first configured instance.
    '''
    return config.is_provider_configured(
        __opts__,
        __active_provider_name__ or 'cloudstack',
        ('apikey', 'secretkey', 'host', 'path')
    )
Example #18
0
def get_configured_provider():
    '''
    Return the first configured instance.
    '''
    return config.is_provider_configured(
        __opts__,
        __active_provider_name__ or 'vsphere',
        ('user',)
    )
Example #19
0
def get_configured_provider():
    '''
    Return the first configured instance.
    '''
    return config.is_provider_configured(
        __opts__,
        __active_provider_name__ or 'linode',
        ('apikey',)
    )
Example #20
0
def get_configured_provider():
    """
    Return the first configured instance.
    """
    return config.is_provider_configured(
        __opts__,
        __active_provider_name__ or "qingcloud",
        ("access_key_id", "secret_access_key", "zone", "key_filename"),
    )
Example #21
0
def get_configured_provider():
    '''
    Return the first configured instance.
    '''
    return config.is_provider_configured(
        __opts__,
        __active_provider_name__ or 'gogrid',
        ('apikey', 'sharedsecret')
    )
Example #22
0
def get_configured_provider():
    '''
    Return the first configured instance.
    '''
    return config.is_provider_configured(
        __opts__,
        __active_provider_name__ or 'dimensiondata',
        ('user_id', 'key', 'region')
    )
Example #23
0
 def test_is_provider_configured_key_is_none(self):
     '''
     Tests when a required configuration key is not set
     '''
     opts = {'providers': {'foo': {'bar': {'api_key': None}}}}
     provider = 'foo:bar'
     self.assertFalse(
         sconfig.is_provider_configured(opts,
                                        provider,
                                        required_keys=('api_key',)))
Example #24
0
def get_configured_provider():
    """
    Return the first configured instance.
    """
    configured = config.is_provider_configured(
        __opts__,
        __active_provider_name__ or __virtualname__,
        ()  # keys we need from the provider configuration
    )
    return configured
def get_configured_provider():
    '''
    Return the first configured instance.
    '''

    return config.is_provider_configured(
        __opts__,
        __active_provider_name__ or 'vcloud',
        ('user', 'org', 'secret', 'host',)
    )
Example #26
0
def get_configured_provider():
    '''
    Return the first configured instance.
    '''
    return config.is_provider_configured(
        __opts__,
        __active_provider_name__ or 'gce',
        ('project',
         'service_account_email_address',
         'service_account_private_key')
    )
Example #27
0
 def test_is_provider_configured_success(self):
     '''
     Tests successful cloud provider configuration
     '''
     opts = {'providers': {'foo': {'bar': {'api_key': 'baz'}}}}
     provider = 'foo:bar'
     ret = {'api_key': 'baz'}
     self.assertEqual(
         sconfig.is_provider_configured(opts,
                                        provider,
                                        required_keys=('api_key',)), ret)
Example #28
0
 def test_is_provider_configured_multiple_success(self):
     '''
     Tests successful cloud provider configuration when searching
     through multiple providers
     '''
     opts = {'providers': {'foo': {'bar': {'api_key': 'baz'}}}}
     provider = 'bar'
     ret = {'api_key': 'baz'}
     self.assertEqual(
         sconfig.is_provider_configured(opts,
                                        provider,
                                        required_keys=('api_key',)), ret)
Example #29
0
def get_configured_provider():
    '''
    Return the first configured instance.
    '''
    warn_until(
        'Carbon',
        'The vsphere driver is deprecated in favor of the vmware driver and will be removed '
        'in Salt Carbon. Please convert your vsphere provider configs to use the vmware driver.'
    )
    return config.is_provider_configured(
        __opts__,
        __active_provider_name__ or 'vsphere',
        ('user',)
    )
Example #30
0
def get_configured_provider():
    '''
    Return the first configured instance.
    '''
    warn_until(
        'Beryllium',
        'The digital_ocean driver is deprecated and will be removed in Salt Beryllium. '
        'Please convert your digital ocean provider configs to use the digital_ocean_v2 '
        'driver.'
    )

    return config.is_provider_configured(
        __opts__,
        __active_provider_name__ or 'digital_ocean',
        ('personal_access_token',)
    )
Example #31
0
def get_configured_provider():
    '''
    Return the first configured instance.
    '''
    return config.is_provider_configured(__opts__, __active_provider_name__
                                         or 'aliyun', ('id', 'key'))
def get_configured_provider():
    '''
    Return the first configured instance.
    '''
    return config.is_provider_configured(
        __opts__, __active_provider_name__ or 'softlayer_hw', ('apikey', ))
Example #33
0
def get_configured_provider():
    '''
    Return the first configured instance.
    '''
    return config.is_provider_configured(
        __opts__, __active_provider_name__ or 'rackspace', ('user', 'apikey'))
Example #34
0
File: xen.py Project: Sygnia/salt-1
def get_configured_provider():
    '''
    Return the first configured instance.
    '''
    return config.is_provider_configured(
        __opts__, __active_provider_name__ or __virtualname__, ('url', ))
Example #35
0
def get_configured_provider():
    '''
    Return the first configured instance.
    '''
    return config.is_provider_configured(__opts__, __active_provider_name__
                                         or 'proxmox', ('user', ))
Example #36
0
def get_configured_provider():
    '''
    Return the first configured instance
    '''
    return config.is_provider_configured(__opts__, __active_provider_name__
                                         or 'vultr', ('api_key', ))
Example #37
0
def get_configured_provider():
    '''
    Return the first configured instance.
    '''
    return config.is_provider_configured(
        __opts__, __active_provider_name__ or 'digital_ocean', ('api_key', ))
Example #38
0
def get_configured_provider():
    '''
    Return the first configured instance.
    '''
    return config.is_provider_configured(__opts__, __active_provider_name__
                                         or 'saltify', ())
Example #39
0
def get_configured_provider():
    """
    Return the first configured instance
    """
    return config.is_provider_configured(__opts__, __active_provider_name__
                                         or "vultr", ("api_key", ))
Example #40
0
def get_configured_provider():
    """
    Return the first configured instance.
    """
    return config.is_provider_configured(__opts__, __active_provider_name__
                                         or "saltify", ())
Example #41
0
def create(vm_):
    """
    get the system build going
    """
    creds = get_creds()
    clc.v1.SetCredentials(creds["token"], creds["token_pass"])
    cloud_profile = config.is_provider_configured(
        __opts__, __active_provider_name__ or __virtualname__, ("token", ))
    group = config.get_cloud_config_value(
        "group",
        vm_,
        __opts__,
        search_global=False,
        default=None,
    )
    name = vm_["name"]
    description = config.get_cloud_config_value(
        "description",
        vm_,
        __opts__,
        search_global=False,
        default=None,
    )
    ram = config.get_cloud_config_value(
        "ram",
        vm_,
        __opts__,
        search_global=False,
        default=None,
    )
    backup_level = config.get_cloud_config_value(
        "backup_level",
        vm_,
        __opts__,
        search_global=False,
        default=None,
    )
    template = config.get_cloud_config_value(
        "template",
        vm_,
        __opts__,
        search_global=False,
        default=None,
    )
    password = config.get_cloud_config_value(
        "password",
        vm_,
        __opts__,
        search_global=False,
        default=None,
    )
    cpu = config.get_cloud_config_value(
        "cpu",
        vm_,
        __opts__,
        search_global=False,
        default=None,
    )
    network = config.get_cloud_config_value(
        "network",
        vm_,
        __opts__,
        search_global=False,
        default=None,
    )
    location = config.get_cloud_config_value(
        "location",
        vm_,
        __opts__,
        search_global=False,
        default=None,
    )
    if len(name) > 6:
        name = name[0:6]
    if len(password) < 9:
        password = ""
    clc_return = clc.v1.Server.Create(
        alias=None,
        location=(location),
        name=(name),
        template=(template),
        cpu=(cpu),
        ram=(ram),
        backup_level=(backup_level),
        group=(group),
        network=(network),
        description=(description),
        password=(password),
    )
    req_id = clc_return["RequestID"]
    vm_["ssh_host"] = get_build_status(req_id, name)
    __utils__["cloud.fire_event"](
        "event",
        "waiting for ssh",
        "salt/cloud/{0}/waiting_for_ssh".format(name),
        sock_dir=__opts__["sock_dir"],
        args={
            "ip_address": vm_["ssh_host"]
        },
        transport=__opts__["transport"],
    )

    # Bootstrap!
    ret = __utils__["cloud.bootstrap"](vm_, __opts__)
    return_message = {"Server Name": name, "IP Address": vm_["ssh_host"]}
    ret.update(return_message)
    return return_message
Example #42
0
def get_configured_provider():
    """
    Return the first configured instance.
    """
    return config.is_provider_configured(
        __opts__, __active_provider_name__ or __virtualname__, ("id", "key"))
Example #43
0
def get_configured_provider():
    '''
    Return the first configured instance.
    '''
    return config.is_provider_configured(__opts__, __active_provider_name__
                                         or 'nova', ('auth_minion', ))
Example #44
0
def get_configured_provider():
    """ Return the first configured instance.
    """
    return config.is_provider_configured(
        __opts__,
        _get_active_provider_name() or __virtualname__, ("token", ))
Example #45
0
def get_configured_provider():
    ''' Return the first configured instance.
    '''
    return config.is_provider_configured(
        __opts__, __active_provider_name__ or 'scaleway', ('token', ))
Example #46
0
File: joyent.py Project: imtx/salt
def get_configured_provider():
    '''
    Return the first configured instance.
    '''
    return config.is_provider_configured(__opts__, __active_provider_name__
                                         or 'joyent', ('user', 'password'))