summaryrefslogtreecommitdiff
path: root/hot
diff options
context:
space:
mode:
Diffstat (limited to 'hot')
-rwxr-xr-xhot/software-config/elements/heat-config-ansible/install.d/hook-ansible.py38
-rwxr-xr-xhot/software-config/elements/heat-config-cfn-init/install.d/hook-cfn-init.py16
-rwxr-xr-xhot/software-config/elements/heat-config-puppet/install.d/hook-puppet.py13
-rwxr-xr-xhot/software-config/elements/heat-config-salt/install.d/hook-salt.py19
-rwxr-xr-xhot/software-config/elements/heat-config-script/install.d/hook-script.py13
-rwxr-xr-xhot/software-config/elements/heat-config/os-refresh-config/configure.d/55-heat-config16
6 files changed, 102 insertions, 13 deletions
diff --git a/hot/software-config/elements/heat-config-ansible/install.d/hook-ansible.py b/hot/software-config/elements/heat-config-ansible/install.d/hook-ansible.py
index 1dd0a78..c244a0a 100755
--- a/hot/software-config/elements/heat-config-ansible/install.d/hook-ansible.py
+++ b/hot/software-config/elements/heat-config-ansible/install.d/hook-ansible.py
@@ -1,4 +1,17 @@
#!/usr/bin/env python
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
import json
import logging
import os
@@ -33,29 +46,37 @@ def main(argv=sys.argv):
variables = {}
for input in c['inputs']:
- variables[input['name']] = input.get('value','')
+ variables[input['name']] = input.get('value', '')
fn = os.path.join(WORKING_DIR, '%s_playbook.yaml' % c['id'])
vars_filename = os.path.join(WORKING_DIR, '%s_variables.json' % c['id'])
heat_outputs_path = os.path.join(OUTPUTS_DIR, c['id'])
variables['heat_outputs_path'] = heat_outputs_path
- config_text = c.get('config','')
+ config_text = c.get('config', '')
if not config_text:
log.warn("No 'config' input found, nothing to do.")
return
#Write 'variables' to file
- with os.fdopen(os.open(vars_filename, os.O_CREAT | os.O_WRONLY, 0o600), 'w') as var_file:
+ with os.fdopen(os.open(
+ vars_filename, os.O_CREAT | os.O_WRONLY, 0o600), 'w') as var_file:
json.dump(variables, var_file)
#Write the executable, 'config', to file
with os.fdopen(os.open(fn, os.O_CREAT | os.O_WRONLY, 0o600), 'w') as f:
- f.write(c.get('config',''))
-
- cmd = ['ansible-playbook','-i','localhost,', fn, '--extra-vars','@%s' % vars_filename]
+ f.write(c.get('config', ''))
+
+ cmd = [
+ 'ansible-playbook',
+ '-i',
+ 'localhost,',
+ fn,
+ '--extra-vars',
+ '@%s' % vars_filename
+ ]
log.debug('Running %s' % (' '.join(cmd),))
try:
subproc = subprocess.Popen([cmd], stdout=subprocess.PIPE,
- stderr=subprocess.PIPE, env=env)
+ stderr=subprocess.PIPE)
except OSError:
log.warn("ansible not installed yet")
return
@@ -67,7 +88,8 @@ def main(argv=sys.argv):
if stderr:
log.info(stderr)
- #TODO: Test if ansible returns any non-zero return codes in success.
+ # TODO(stevebaker): Test if ansible returns any non-zero
+ # return codes in success.
if subproc.returncode:
log.error("Error running %s. [%s]\n" % (fn, subproc.returncode))
else:
diff --git a/hot/software-config/elements/heat-config-cfn-init/install.d/hook-cfn-init.py b/hot/software-config/elements/heat-config-cfn-init/install.d/hook-cfn-init.py
index 94e2f67..0f8ce9f 100755
--- a/hot/software-config/elements/heat-config-cfn-init/install.d/hook-cfn-init.py
+++ b/hot/software-config/elements/heat-config-cfn-init/install.d/hook-cfn-init.py
@@ -1,8 +1,22 @@
#!/usr/bin/env python
-from heat_cfntools.cfntools import cfn_helper
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
import json
import sys
+from heat_cfntools.cfntools import cfn_helper
+
def main(argv=sys.argv):
c = json.load(sys.stdin)
diff --git a/hot/software-config/elements/heat-config-puppet/install.d/hook-puppet.py b/hot/software-config/elements/heat-config-puppet/install.d/hook-puppet.py
index ef46059..3462401 100755
--- a/hot/software-config/elements/heat-config-puppet/install.d/hook-puppet.py
+++ b/hot/software-config/elements/heat-config-puppet/install.d/hook-puppet.py
@@ -1,4 +1,17 @@
#!/usr/bin/env python
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
import json
import logging
import os
diff --git a/hot/software-config/elements/heat-config-salt/install.d/hook-salt.py b/hot/software-config/elements/heat-config-salt/install.d/hook-salt.py
index 3044d78..d4043e1 100755
--- a/hot/software-config/elements/heat-config-salt/install.d/hook-salt.py
+++ b/hot/software-config/elements/heat-config-salt/install.d/hook-salt.py
@@ -1,13 +1,26 @@
#!/usr/bin/env python
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
import json
import logging
import os
-import salt.cli
-import salt.config
import sys
-import yaml
+import salt.cli
+import salt.config
from salt.exceptions import SaltInvocationError
+import yaml
WORKING_DIR = os.environ.get('HEAT_SALT_WORKING',
diff --git a/hot/software-config/elements/heat-config-script/install.d/hook-script.py b/hot/software-config/elements/heat-config-script/install.d/hook-script.py
index 4403ccb..b7399b3 100755
--- a/hot/software-config/elements/heat-config-script/install.d/hook-script.py
+++ b/hot/software-config/elements/heat-config-script/install.d/hook-script.py
@@ -1,4 +1,17 @@
#!/usr/bin/env python
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
import json
import logging
import os
diff --git a/hot/software-config/elements/heat-config/os-refresh-config/configure.d/55-heat-config b/hot/software-config/elements/heat-config/os-refresh-config/configure.d/55-heat-config
index 1c5fa24..b5e6934 100755
--- a/hot/software-config/elements/heat-config/os-refresh-config/configure.d/55-heat-config
+++ b/hot/software-config/elements/heat-config/os-refresh-config/configure.d/55-heat-config
@@ -1,11 +1,25 @@
#!/usr/bin/env python
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
import json
import logging
import os
-import requests
import subprocess
import sys
+import requests
+
HOOKS_DIR = os.environ.get('HEAT_CONFIG_HOOKS',
'/var/lib/heat-config/hooks')
CONF_FILE = os.environ.get('HEAT_SHELL_CONFIG',