Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add config.py

  • Loading branch information...
commit 5771daa344d7859c0f0969616c070b87f9a75646 1 parent fff4510
Thomas S Hatch thatch45 authored
Showing with 50 additions and 0 deletions.
  1. +50 −0 config.py
50 config.py
View
@@ -0,0 +1,50 @@
+'''
+Manage configuration files in salt-cloud
+'''
+
+# Import python libs
+import os
+
+# Import salt libs
+import salt.config
+
+
+def cloud_config(path):
+ '''
+ Read in the salt cloud config and return the dict
+ '''
+ opts = {# Provider defaults
+ 'provider': '',
+ 'location': '',
+ # User/Passwords/keys
+ 'RACKSPACE_key': '',
+ 'RACKSPACE_user': '',
+ 'LINODE_apikey': '',
+ 'EC2_key': '',
+ 'EC2_user': '',
+ # Global defaults
+ 'ssh_auth': '',
+ 'keysize': 4096,
+ 'os': '',
+ }
+
+ salt.config.load_config(opts, path, 'SALT_CLOUD_CONFIG')
+
+ if 'include' in opts:
+ opts = include_config(opts, path)
+
+ return opts
+
+def vm_config(path):
+ '''
+ Read in the salt cloud vm config file
+ '''
+ # No defaults
+ opts = {}
+
+ salt.config.load_config(opts, path, 'SALT_CLOUDVM_CONFIG')
+
+ if 'include' in opts:
+ opts = include_config(opts, path)
+
+ return opts
Please sign in to comment.
Something went wrong with that request. Please try again.