0

我正在尝试使用saltstack在AWS中预置一个实例。我有盐版salt 2016.11.1 (Carbon),我的配置如下

cloud.providers.d

 ec2-us-west-2-public:
  minion:
    master: 35.165.44.29
  id: AKIAI3XH2SIF4P37AZZA
  key: atdvow2UY2rXQqYQNqerQ4WqRzScHlzZ91kxqjFx
  private_key: /etc/salt/salt.pem
  keyname: salt
  ssh_interface: public_ips
  securitygroup: sg-c4a5abbd
  location: us-west-2
  availability_zone: us-west-2a
  provider: ec2
  del_root_vol_on_destroy: True
  del_all_vols_on_destroy: True
  rename_on_destroy: True

cloud.profiles.d

ec2_west_nano_prod:
  provider: ec2-us-west-2-public
  image:  ami-b7a114d7
  size: t2.micro
  ssh_username: ubuntu
  tag: {'Environment': 'production'}
  availability_zone: us-west-2a
  block_device_mappings:
   - DeviceName: /dev/sda1
     EbsVolumeSize: 8
  minion:
     master: 35.165.44.29
  networkinterfaces:
   -DeviceIndex: 0
  PrivateIPAddresses:
   -Primary: True
   AssociatedPublicIPAddresses: False
   SubnetId: subnet-f1767887

当我尝试运行salt-cloud -m cloud.map.d/ec2-us-west-2.conf 时出现错误提示

/usr/lib/python2.7/dist-packages/salt/config/__init__.py:2617: DeprecationWarning: The term 'provider' is being deprecated in favor of 'driver'. Support for 'provider' will be removed in Salt Nitrogen. Please convert your cloud provider configuration files to use 'driver'.
[ERROR   ] 'provider'
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/salt/utils/parsers.py", line 200, in parse_args
    process_option_func()
  File "/usr/lib/python2.7/dist-packages/salt/utils/parsers.py", line 516, in process_config_dir
    self.config.update(self.setup_config())
  File "/usr/lib/python2.7/dist-packages/salt/utils/parsers.py", line 3022, in setup_config
    return config.cloud_config(self.get_config_file_path())
  File "/usr/lib/python2.7/dist-packages/salt/config/__init__.py", line 2231, in cloud_config
    providers_config)
  File "/usr/lib/python2.7/dist-packages/salt/config/__init__.py", line 2398, in vm_profiles_config
    return apply_vm_profiles_config(providers, overrides, defaults)
  File "/usr/lib/python2.7/dist-packages/salt/config/__init__.py", line 2425, in apply_vm_profiles_config
    if ':' in details['provider']:
KeyError: 'provider'
Usage: salt-cloud [options] <-m MAP | -p PROFILE> <NAME> [NAME2 ...]

salt-cloud: error: Error while processing <bound method SaltCloud.process_config_dir of <salt.cloud.cli.SaltCloud object at 0x7fc329091a10>>: Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/salt/utils/parsers.py", line 200, in parse_args
    process_option_func()
  File "/usr/lib/python2.7/dist-packages/salt/utils/parsers.py", line 516, in process_config_dir
    self.config.update(self.setup_config())
  File "/usr/lib/python2.7/dist-packages/salt/utils/parsers.py", line 3022, in setup_config
    return config.cloud_config(self.get_config_file_path())
  File "/usr/lib/python2.7/dist-packages/salt/config/__init__.py", line 2231, in cloud_config
    providers_config)
  File "/usr/lib/python2.7/dist-packages/salt/config/__init__.py", line 2398, in vm_profiles_config
    return apply_vm_profiles_config(providers, overrides, defaults)
  File "/usr/lib/python2.7/dist-packages/salt/config/__init__.py", line 2425, in apply_vm_profiles_config
    if ':' in details['provider']:
KeyError: 'provider'

有什么问题?

4

1 回答 1

0

我正在使用 Salt Formula 来管理我的主人,并注意到问题是由这个部分引起的:

profiles:
  company-profiles.conf:
    ec2-or:
      ec2.oregon.small:
        network_interfaces:
          - DeviceIndex: 0
            SubnetId: subnet-foobar
            SecurityGroupId:
              - sg-foobar
        provider: ec2-or
        image: ami-foobar
        size: t2.small
        ssh_username: foobar
        del_root_vol_on_destroy: True
        del_all_vol_on_destroy: True
        sync_after_install: grains

我的配置文件 conf 文件中的 ec2-or 部分是不必要的,并导致底层 python dict 嵌套在“ec2-or”中,并且无法找到提供程序。

于 2017-02-15T16:04:58.010 回答