def create_custom_env_file_on_target(self, environment): posix = not self.cloudify_agent['windows'] env_file = utils.env_to_file(env_variables=environment, posix=posix) if env_file: return self.runner.put_file(src=env_file) else: return None
def test_extra_env(self): daemon = self.create_daemon() daemon.extra_env_path = utils.env_to_file( {'TEST_ENV_KEY': 'TEST_ENV_VALUE'}, posix=os.name == 'posix') daemon.create() daemon.configure() self.installer.install(self.plugin_struct()) daemon.start() # check the env file was properly sourced by querying the env # variable from the daemon process. this is done by a task value = self.send_task(task_name='mock_plugin.tasks.get_env_variable', queue=daemon.queue, kwargs={'env_variable': 'TEST_ENV_KEY'}) self.assertEqual(value, 'TEST_ENV_VALUE')
def test_extra_env(self): daemon = self.create_daemon() daemon.extra_env_path = utils.env_to_file( {'TEST_ENV_KEY': 'TEST_ENV_VALUE'}, posix=os.name == 'posix' ) daemon.create() daemon.configure() self.installer.install(self.plugin_struct()) daemon.start() # check the env file was properly sourced by querying the env # variable from the daemon process. this is done by a task value = self.send_task( task_name='mock_plugin.tasks.get_env_variable', queue=daemon.queue, kwargs={'env_variable': 'TEST_ENV_KEY'}) self.assertEqual(value, 'TEST_ENV_VALUE')
def test_extra_env_path(self): daemon = self.create_daemon() daemon.extra_env_path = utils.env_to_file( {'TEST_ENV_KEY': 'TEST_ENV_VALUE'}, posix=os.name == 'posix' ) daemon.create() daemon.configure() self.installer.install( os.path.join(resources.get_resource('plugins'), 'mock-plugin')) daemon.register('mock-plugin') daemon.start() # check the env file was properly sourced by querying the env # variable from the daemon process. this is done by a task value = self.celery.send_task( name='mock_plugin.tasks.get_env_variable', queue=daemon.queue, args=['TEST_ENV_KEY']).get(timeout=10) self.assertEqual(value, 'TEST_ENV_VALUE')
def create_custom_env_file_on_target(self, environment): posix = not self.cloudify_agent['windows'] self.logger.debug( 'Creating a environment file from {0}'.format(environment)) return utils.env_to_file(env_variables=environment, posix=posix)
def create_custom_env_file_on_target(self, environment): posix = not self.cloudify_agent['windows'] self.logger.debug('Creating a environment file from {0}' .format(environment)) return utils.env_to_file(env_variables=environment, posix=posix)