Change action temp files to contain resource.name

This commit is contained in:
Dmitry Shulyak 2015-10-12 17:50:39 +03:00
parent 6d72f47dcd
commit 9490fa7c59
3 changed files with 8 additions and 5 deletions

View File

@ -7,7 +7,7 @@ input:
value: value:
target_directory: target_directory:
schema: str! schema: str!
value: /var/lib/astute value: /var/lib/astute/
key_name: key_name:
schema: str! schema: str!
value: ceph value: ceph

View File

@ -103,12 +103,14 @@ class Puppet(TempFileHandler):
self.upload_manifests(resource) self.upload_manifests(resource)
action_file_name = '/tmp/{}.pp'.format(resource.name)
self.prepare_templates_and_scripts(resource, action_file, '') self.prepare_templates_and_scripts(resource, action_file, '')
self.transport_sync.copy(resource, action_file, '/tmp/action.pp') self.transport_sync.copy(resource, action_file, action_file_name)
self.transport_sync.sync_all() self.transport_sync.sync_all()
cmd_args = ['puppet', 'apply', '-vd', cmd_args = ['puppet', 'apply', '-vd',
'/tmp/action.pp', '--detailed-exitcodes'] action_file_name,
'--detailed-exitcodes']
if 'puppet_modules' in resource.args: if 'puppet_modules' in resource.args:
cmd_args.append('--modulepath={}'.format( cmd_args.append('--modulepath={}'.format(
resource.args['puppet_modules'])) resource.args['puppet_modules']))

View File

@ -24,11 +24,12 @@ class Shell(TempFileHandler):
action_file = self._compile_action_file(resource, action_name) action_file = self._compile_action_file(resource, action_name)
log.debug('action_file: %s', action_file) log.debug('action_file: %s', action_file)
self.transport_sync.copy(resource, action_file, '/tmp/action.sh') action_file_name = '/tmp/{}.sh'.format(resource.name)
self.transport_sync.copy(resource, action_file, action_file_name)
self.transport_sync.sync_all() self.transport_sync.sync_all()
cmd = self.transport_run.run( cmd = self.transport_run.run(
resource, resource,
'bash', '/tmp/action.sh', 'bash', action_file_name,
use_sudo=True, use_sudo=True,
warn_only=True warn_only=True
) )