Unicone 3在未启用透明同步时将项目同步到磁盘

时间:2016-03-22 16:41:46

标签: sitecore sitecore-unicorn

我有一个Sitecore 7.2解决方案,我已经安装了Unicorn 3。

我使用了提供的默认配置文件。在开发时,我在执行初始同步后启用了透明同步

<dataProviderConfiguration type="Unicorn.Data.DataProvider.DefaultUnicornDataProviderConfiguration, Unicorn" enableTransparentSync="true" /> 

我创建了一个transofrm文件,这样当我将解决方案部署到非开发环境时,它会将enableTransparentSync切换回false。

在此解决方案中,有一些自定义模块,我正在使用由Benjamin Vangansewinkel创建的命令Package Installer (https://github.com/VGBenjamin/PackageInstaller

当我运行命令行来安装软件包时,它会给我一个错误,指示它无法将yml文件写入磁盘。

现在我检查了此环境中的Unicorn.config文件,我可以确认enableTransparentSync设置为false。

我试图安装的软件包试图创建项目到/ sitecore / content / Applications / Content Editor / Context Menues / Default /我可以看到使用默认配置,/ sitecore / content / Applications /中的所有内容将同步。

在开发机器上,安装了所有sitecore模块,并将/ sitecore / content / Applications / Content Editor / Context Menues / Default /下的yml文件序列化为磁盘。

这可能是我的误解,但我认为如果禁用透明同步,那么当对Sitecore进行更改时,您必须转到unicorn控制面板并手动同步所有修改。那么,为什么我会在没有启用透明同步时遇到无法将更改写入磁盘的错误。

现在另一个选项是从default.config中删除以下行

<include database="core" path="/sitecore/system/Field types"/>
<include name="Core Settings" database="core" path="/sitecore/system/Settings" />
<include name="Core Start Menu" database="core" path="/sitecore/content/Documents and settings/All users"/>
<include name="Core Applications" database="core" path="/sitecore/content/Applications"/>

但在我这样做之前,我想知道为什么Unicorn似乎使用透明同步。

仅供参考:这是完整的错误堆栈

2016-03-22 15:38:15,996 [1] ERROR Sidewalk.SC.PackageInstaller.Client.Program [(null)] - System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.UnauthorizedAccessException: Access to the path 'D:\Websites\CI\Website\Unicorn\Default Configuration\Core Applications\Applications\Content Editor\Context Menues\Default\Bulk Export.yml' is denied.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.File.InternalDelete(String path, Boolean checkHost)
   at Rainbow.Storage.SerializationFileSystemTree.WriteItem(IItemData item, String path)
   at Rainbow.Storage.SerializationFileSystemTree.Save(IItemData item)
   at Unicorn.Data.DataProvider.UnicornDataProvider.SaveItem(ItemDefinition itemDefinition, ItemChanges changes, CallContext context)
   at Unicorn.Data.DataProvider.UnicornSqlServerDataProvider.SaveItem(ItemDefinition itemDefinition, ItemChanges changes, CallContext context)
   at Sitecore.Data.DataProviders.DataProvider.SaveItem(ItemDefinition item, ItemChanges changes, CallContext context, DataProviderCollection providers)
   at Sitecore.Data.DataSource.SaveItem(ID itemID, ItemChanges changes)
   at Sitecore.Data.Engines.EngineCommand`2.Execute()
   at Sitecore.Data.Engines.DataEngine.SaveItem(Item item)
   at Sitecore.Data.Managers.ItemProvider.SaveItem(Item item)
   at Sitecore.Data.Items.ItemEditing.AcceptChanges(Boolean updateStatistics, Boolean silent)
   at Sitecore.Install.Items.ItemInstaller.VersionInstaller.InstallVersion(Item version)
   at Sitecore.Install.Items.ItemInstaller.VersionInstaller.PasteVersion(XmlNode versionXml, Item target, VersionInstallMode mode, IProcessingContext context, Boolean removeOtherVersions)
   at Sitecore.Install.Items.ItemInstaller.InstallEntry(PackageEntry entry)
   at Sitecore.Install.Items.ItemInstaller.Flush()
   at Sitecore.Install.Framework.SinkDispatcher.Flush()
   at Sitecore.Install.Utils.EntrySorter.Flush()
   at Sitecore.Install.Framework.EntryBuilder.Flush()
   at Sitecore.Install.Zip.PackageReader.Populate(ISink`1 sink)
   at Sitecore.Install.Installer.InstallPackage(String path, Boolean registerInstallation, ISource`1 source, IProcessingContext context)
   at Sitecore.Install.Installer.InstallPackage(String path, ISource`1 source, IProcessingContext context)
   at Sidewalk.SC.PackageInstaller.Service.SitecorePackageInstaller.InstallPackage(String path)
   --- End of inner exception stack trace ---
System.Web.Services.Protocols.SoapException: System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.UnauthorizedAccessException: Access to the path 'D:\Websites\CI\Website\Unicorn\Default Configuration\Core Applications\Applications\Content Editor\Context Menues\Default\Bulk Export.yml' is denied.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.File.InternalDelete(String path, Boolean checkHost)
   at Rainbow.Storage.SerializationFileSystemTree.WriteItem(IItemData item, String path)
   at Rainbow.Storage.SerializationFileSystemTree.Save(IItemData item)
   at Unicorn.Data.DataProvider.UnicornDataProvider.SaveItem(ItemDefinition itemDefinition, ItemChanges changes, CallContext context)
   at Unicorn.Data.DataProvider.UnicornSqlServerDataProvider.SaveItem(ItemDefinition itemDefinition, ItemChanges changes, CallContext context)
   at Sitecore.Data.DataProviders.DataProvider.SaveItem(ItemDefinition item, ItemChanges changes, CallContext context, DataProviderCollection providers)
   at Sitecore.Data.DataSource.SaveItem(ID itemID, ItemChanges changes)
   at Sitecore.Data.Engines.EngineCommand`2.Execute()
   at Sitecore.Data.Engines.DataEngine.SaveItem(Item item)
   at Sitecore.Data.Managers.ItemProvider.SaveItem(Item item)
   at Sitecore.Data.Items.ItemEditing.AcceptChanges(Boolean updateStatistics, Boolean silent)
   at Sitecore.Install.Items.ItemInstaller.VersionInstaller.InstallVersion(Item version)
   at Sitecore.Install.Items.ItemInstaller.VersionInstaller.PasteVersion(XmlNode versionXml, Item target, VersionInstallMode mode, IProcessingContext context, Boolean removeOtherVersions)
   at Sitecore.Install.Items.ItemInstaller.InstallEntry(PackageEntry entry)
   at Sitecore.Install.Items.ItemInstaller.Flush()
   at Sitecore.Install.Framework.SinkDispatcher.Flush()
   at Sitecore.Install.Utils.EntrySorter.Flush()
   at Sitecore.Install.Framework.EntryBuilder.Flush()
   at Sitecore.Install.Zip.PackageReader.Populate(ISink`1 sink)
   at Sitecore.Install.Installer.InstallPackage(String path, Boolean registerInstallation, ISource`1 source, IProcessingContext context)
   at Sitecore.Install.Installer.InstallPackage(String path, ISource`1 source, IProcessingContext context)
   at Sidewalk.SC.PackageInstaller.Service.SitecorePackageInstaller.InstallPackage(String path)
   --- End of inner exception stack trace ---
   at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
   at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
   at Sidewalk.SC.PackageInstaller.Client.ServiceReference.SitecorePackageInstaller.InstallPackage(String path) in C:\Projects\PackageInstaller\Sidewalk.SC.PackageInstaller.Client\Web References\ServiceReference\Reference.cs:line 88
   at Sidewalk.SC.PackageInstaller.Client.Program.Main(String[] args) in C:\Projects\PackageInstaller\Sidewalk.SC.PackageInstaller.Client\Program.cs:line 281

您可以看到内部异常正在尝试将项目保存到磁盘        在Rainbow.Storage.SerializationFileSystemTree.WriteItem(IItemData项,字符串路径)

更新

大家都知道,这个问题与我的CI环境有关,我在部署过程中遇到了错误。

更新2

我已阅读博文http://kamsar.net/index.php/2015/10/Unicorn-Introducing-Transparent-Sync/,我显然仍在理解。

有以下文字:

  

注意:在启用透明同步之前,必须先执行配置的初始序列化。否则,配置中的项目似乎会消失,因为透明同步显示磁盘上的所有零项目!

     

启用透明同步非常简单:将您想要添加透明同步并将其放入其中:

  

启用透明同步后,您只需更改磁盘上的项目,更新将立即显示在Sitecore中。

读取它,我认为如果你可以打开透明同步,那么你可以再次关闭它。

https://github.com/kamsar/Unicorn查看自述文件我假设要在其他环境中进行同步,在部署之后,您可以使用powershell向控制面板发出http查询。

如果无法关闭透明同步,那么在部署到CI环境时停止透明同步的最佳做法是什么?并使用PowerShell进行更新。

目前我只希望透明同步在开发环境中工作

1 个答案:

答案 0 :(得分:0)

我认为你误解了透明同步。

它做的是什么;它允许更新的YML立即反映在Sitecore中,而无需执行新的同步。它通过偷偷摸摸的数据提供对Sitecore的更改。这对于您刚从GIT撤出或者在分支机构之间切换时非常有用 - 消除了必须同步(或忘记)的麻烦。

它不做的是禁用Sitecore更改的自动同步。对于Unicorn被告知要控制的内容树的任何区域,这些都会一直写入磁盘。

事实上,几乎与你所写的相反; &#34;这可能是我的误解,但我认为如果禁用透明同步,那么当对Sitecore进行更改时,您必须转到unicorn控制面板并手动同步所有修改。那么,为什么我在没有启用透明同步时会遇到无法将更改写入磁盘的错误。&#34;

参考:http://kamsar.net/index.php/2015/10/Unicorn-Introducing-Transparent-Sync/