本文整理汇总了Python中pulp.plugins.util.publish_step.PublishStep._create_symlink方法的典型用法代码示例。如果您正苦于以下问题:Python PublishStep._create_symlink方法的具体用法?Python PublishStep._create_symlink怎么用?Python PublishStep._create_symlink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pulp.plugins.util.publish_step.PublishStep
的用法示例。
在下文中一共展示了PublishStep._create_symlink方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_create_symlink_no_link_parent
# 需要导入模块: from pulp.plugins.util.publish_step import PublishStep [as 别名]
# 或者: from pulp.plugins.util.publish_step.PublishStep import _create_symlink [as 别名]
def test_create_symlink_no_link_parent(self):
source_path = os.path.join(self.working_dir, 'source')
link_path = os.path.join(self.published_dir, 'foo/bar/baz/link')
touch(source_path)
self.assertFalse(os.path.exists(os.path.dirname(link_path)))
PublishStep._create_symlink(source_path, link_path)
self.assertTrue(os.path.exists(link_path))
示例2: test_publish_distribution_packages_link_with_packagedir_delete_existing_packages
# 需要导入模块: from pulp.plugins.util.publish_step import PublishStep [as 别名]
# 或者: from pulp.plugins.util.publish_step.PublishStep import _create_symlink [as 别名]
def test_publish_distribution_packages_link_with_packagedir_delete_existing_packages(self):
packages_dir = os.path.join(self.working_dir, 'Packages')
old_directory = os.path.join(self.working_dir, "foo")
os.mkdir(old_directory)
PublishStep._create_symlink(old_directory, packages_dir)
self.assertEquals(os.path.realpath(packages_dir), old_directory)
unit = self._generate_distribution_unit('one', {'packagedir': 'Packages'})
step = publish.PublishDistributionStep()
step.parent = self.publisher
step._publish_distribution_packages_link(unit)
self.assertFalse(os.path.islink(packages_dir))
示例3: test_create_symlink
# 需要导入模块: from pulp.plugins.util.publish_step import PublishStep [as 别名]
# 或者: from pulp.plugins.util.publish_step.PublishStep import _create_symlink [as 别名]
def test_create_symlink(self):
source_path = os.path.join(self.working_dir, 'source')
link_path = os.path.join(self.published_dir, 'link')
touch(source_path)
self.assertFalse(os.path.exists(link_path))
PublishStep._create_symlink(source_path, link_path)
self.assertTrue(os.path.exists(link_path))
self.assertTrue(os.path.islink(link_path))
self.assertEqual(os.readlink(link_path), source_path)
示例4: test_create_symlink_link_exists_and_is_correct
# 需要导入模块: from pulp.plugins.util.publish_step import PublishStep [as 别名]
# 或者: from pulp.plugins.util.publish_step.PublishStep import _create_symlink [as 别名]
def test_create_symlink_link_exists_and_is_correct(self):
new_source_path = os.path.join(self.working_dir, 'new_source')
link_path = os.path.join(self.published_dir, 'link')
touch(new_source_path)
os.symlink(new_source_path, link_path)
self.assertEqual(os.readlink(link_path), new_source_path)
PublishStep._create_symlink(new_source_path, link_path)
self.assertEqual(os.readlink(link_path), new_source_path)
示例5: test_create_symlink_link_exists
# 需要导入模块: from pulp.plugins.util.publish_step import PublishStep [as 别名]
# 或者: from pulp.plugins.util.publish_step.PublishStep import _create_symlink [as 别名]
def test_create_symlink_link_exists(self):
old_source_path = os.path.join(self.working_dir, 'old_source')
new_source_path = os.path.join(self.working_dir, 'new_source')
link_path = os.path.join(self.published_dir, 'link')
touch(old_source_path)
touch(new_source_path)
os.symlink(old_source_path, link_path)
self.assertEqual(os.readlink(link_path), old_source_path)
link_path_with_slash = link_path + '/'
PublishStep._create_symlink(new_source_path, link_path_with_slash)
self.assertEqual(os.readlink(link_path), new_source_path)
示例6: test_create_symlink
# 需要导入模块: from pulp.plugins.util.publish_step import PublishStep [as 别名]
# 或者: from pulp.plugins.util.publish_step.PublishStep import _create_symlink [as 别名]
def test_create_symlink(self, mock_symlink):
step = PublishStep("foo")
step._create_symlink('foo', 'bar')
mock_symlink.assert_called_once_with('foo', 'bar')