Skip to content

Commit e4be436

Browse files
author
Nicole Thomas
authored
Merge pull request #43674 from alexbleotu/storage_policies-gh
VMware vCenter proxy + storage policies states & dependencies
2 parents 05d10e7 + 5c3109f commit e4be436

File tree

10 files changed

+2412
-18
lines changed

10 files changed

+2412
-18
lines changed

salt/config/schemas/vcenter.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
# Import Salt libs
1616
from salt.utils.schema import (Schema,
17+
ArrayItem,
18+
IntegerItem,
1719
StringItem)
1820

1921

@@ -31,3 +33,25 @@ class VCenterEntitySchema(Schema):
3133
vcenter = StringItem(title='vCenter',
3234
description='Specifies the vcenter hostname',
3335
required=True)
36+
37+
38+
class VCenterProxySchema(Schema):
39+
'''
40+
Schema for the configuration for the proxy to connect to a VCenter.
41+
'''
42+
title = 'VCenter Proxy Connection Schema'
43+
description = 'Schema that describes the connection to a VCenter'
44+
additional_properties = False
45+
proxytype = StringItem(required=True,
46+
enum=['vcenter'])
47+
vcenter = StringItem(required=True, pattern=r'[^\s]+')
48+
mechanism = StringItem(required=True, enum=['userpass', 'sspi'])
49+
username = StringItem()
50+
passwords = ArrayItem(min_items=1,
51+
items=StringItem(),
52+
unique_items=True)
53+
54+
domain = StringItem()
55+
principal = StringItem(default='host')
56+
protocol = StringItem(default='https')
57+
port = IntegerItem(minimum=1)

salt/modules/vcenter.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# -*- coding: utf-8 -*-
2+
'''
3+
Module used to access the vcenter proxy connection methods
4+
'''
5+
from __future__ import absolute_import
6+
7+
# Import python libs
8+
import logging
9+
import salt.utils
10+
11+
12+
log = logging.getLogger(__name__)
13+
14+
__proxyenabled__ = ['vcenter']
15+
# Define the module's virtual name
16+
__virtualname__ = 'vcenter'
17+
18+
19+
def __virtual__():
20+
'''
21+
Only work on proxy
22+
'''
23+
if salt.utils.is_proxy():
24+
return __virtualname__
25+
return False
26+
27+
28+
def get_details():
29+
return __proxy__['vcenter.get_details']()

0 commit comments

Comments
 (0)