def test_extract_plugin_name_from_local_folder(self): from windows_plugin_installer.plugin_utils import extract_plugin_name from windows_plugin_installer.tests import resources plugin_url = "{0}\mock-plugin".format(os.path.dirname(resources.__file__)) self.assertEqual("mock-plugin", extract_plugin_name(plugin_url))
def test_extract_plugin_name_from_remote_url(self): from windows_plugin_installer.plugin_utils import extract_plugin_name plugin_url = 'https://github.com/cloudify-cosmo/' \ 'cloudify-bash-plugin/archive/master.zip' self.assertEqual('cloudify-bash-plugin', extract_plugin_name(plugin_url))
def test_extract_plugin_name_from_local_folder(self): from windows_plugin_installer.plugin_utils import \ extract_plugin_name from windows_plugin_installer.tests import \ resources plugin_url = '{0}\mock-plugin'\ .format(os.path.dirname(resources.__file__)) self.assertEqual('mock-plugin', extract_plugin_name(plugin_url))
def install_celery_plugin(plugin_url): """ Installs celery tasks into the cloudify agent. 1. Installs the plugin into the current python installation directory. 2 Adds the python files into the agent includes directive. :param plugin_url: URL to an archive of the plugin. """ command = 'cmd /c "{0}\Scripts\pip.exe install {1}"' \ .format(sys.prefix, plugin_url) utils.LocalCommandRunner( logger=logger, host=utils.get_local_ip() ).run(command) plugin_name = plugin_utils.extract_plugin_name(plugin_url) module_paths = plugin_utils.extract_module_paths(plugin_name) _update_includes(module_paths)
def install_celery_plugin(plugin_url): ''' Installs celery tasks into the cloudify agent. 1. Installs the plugin into the current python installation directory. 2 Adds the python files into the agent includes directive. :param plugin_url: URL to an archive of the plugin. :return: ''' command = 'cmd /c "{0}\Scripts\pip.exe install --process-dependency-links {1}"'\ .format(sys.prefix, plugin_url) LocalCommandRunner().run(command) plugin_name = plugin_utils.extract_plugin_name(plugin_url) module_paths = plugin_utils.extract_module_paths(plugin_name) _update_includes(module_paths)
def test_extract_plugin_name_from_remote_url(self): from windows_plugin_installer.plugin_utils import extract_plugin_name plugin_url = "https://github.com/cloudify-cosmo/" "cloudify-bash-plugin/archive/master.zip" self.assertEqual("cloudify-bash-plugin", extract_plugin_name(plugin_url))