Closed piyush94 closed 5 years ago
Right now the windows share has to be mounted to the DeployHub docker container.
Enhancement is to create a Windows FS repository that will "check out" from the windows share to the drop zone.
Use pre-action at the application to pull files from the windows folder to a location in the docker container. Then a file system repository will be used push the files to the end points.
@piyush94 Are the files being shared via a Windows Server or another way such as a NAS? If it is a windows server, will there be WinRM access to it?
CC: @svisagan83
@sbtaylor15 In most cases it's a Windows Server with a shared location. Regarding WinRM, it comes disabled by default, so we have to go and enable it initially. It will have WinRM access after that.
CC: @svisagan83
@piyush94 I believe we have a found solution that will work without the need for WinRM and work directly against the windows share. Testing it out now.
@piyush94 here is the setup. Please pull the latest docker image then import the procedure into the GLOBAL Functions & Procedures tree.
Next, setup the Action
Next, setup a Component that uses the Action as a Custom Action. Make this component the first one in the list of Components for the Application Version.
CC: @svisagan83
@piyush94 FYI, no WinRM changes are needed.
Also, you can skip the "mount" component and put the Action as a Pre-Action to the Application Version.
@sbtaylor15 I am getting this error:
I have created a filesystem repo pointing to the winshare_folder, that as per my understating, will be in the deployhub container, and the above action is supposed to mount the windows share at that location.
Let me know if i am missing something.
CC: @svisagan83
@piyush94 make sure your WriteEnv2File procedure has the following code at the start. Replace what is there in your proc with this.
set -g RspFile = ${dropzone.path} + "/env.dat";
set sname = ${component.name.regsub("[-.; ]","_")};
eval("using stream \$$sname;");
eval("set envstream = \$$sname;");
using stream $envstream {
For the file system repo - set it up as file path = /winshares
and mark it as appendable
.
For the mount component item attrs set the winshare_folder = share
and winshare_sharename = \\USTR-UVM-12271\c$
The files will end up in the container as /winshares/USTR-UVM-12271/c$/share/site.zip
so set the IIS component item file path = USTR-UVM-12271/c$/share
and pattern = site.zip
CC: @svisagan83
@sbtaylor15 Did the above changes but still same error.
CC: @svisagan83
How is the Action setup to run? Pre action to the application or a custom action for a component?
Pre action to application.
@piyush94 - ok, the component.name is undefined at that level. Change the WriteEnv2File as follows:
set -g RspFile = ${dropzone.path} + "/env.dat";
set d = now();
set sname = "s" + ${d.to_int()};
eval("using stream \$$sname;");
eval("set envstream = \$$sname;");
@piyush94 also, let me know if you see this error msg in the output. Its inconsistently showing up.
directory_create_or_exist: mkdir failed on directory /var/lib/samba/lock/msg.lock: Permission denied
@piyush94 - ok, the component.name is undefined at that level. Change the WriteEnv2File as follows:
set -g RspFile = ${dropzone.path} + "/env.dat"; set d = now(); set sname = "s" + ${d.to_int()}; eval("using stream \$$sname;"); eval("set envstream = \$$sname;");
Will this affect ansible playbook action at component level?
The stream name needs to be unique and changing it to use the time in seconds will do that. The change is compatible for the actions at the component level.
@sbtaylor15 above issue is gone, but a new issue is happening.
INFO: Starting deployment #265
--
INFO: Deploying Application "Deploy_IIS_Site;1" into Environment "IIS_Env"
Deploying to
Syntax error at line 37 of "action WriteEnv2File": Invalid type for for loop - must be string, array or stream
INFO: Time taken 0.011769 seconds
WriteEnv2File at line 37:
foreach(env: ${server.attributes}) {
echo $env + ": " + ${server.attributes[$env]};
}
CC: @svisagan83
@piyush94 - We had to rework the logic a bit due to clashes in the dropzone. We remove the WriteEnv2File in the mount action and replaced it with a get credentials procedure. Then we passed in the variables to the mount proc instead of using a env file to pass them in.
Import the GetWinShareCredentials into the GLOBAL domain. export_GetWinShareCredentials.zip
Then change the RunWinShare Proc as follows:
Next change the MountWinShare Action as follows:
At the application attribute level set the following variables and use MountWinShare action as a Pre-Action to the application
CC: @svisagan83
@piyush94 - also pull the latest image
CC: @svisagan83
@sbtaylor15 This one worked to some extent. I was getting the below error:
Turns out in our case the access to winshares is controlled by Active Directory and we also need to pass the user domain also. ref: https://askubuntu.com/questions/109507/smbclient-getting-nt-status-logon-failure-connecting-to-windows-box
So, i changed the dh2winshare script to accept a user domain variable and it was able to mount the share, but it failed to copy files from the path.
CC: @svisagan83
@sbtaylor15 script changes:
@click.option('--winshare_userdom', help='User domain', required=True)
def main(winshare_user, winshare_pass, winshare_sharename, winshare_folder, winshare_userdom):
"""Main entry point"""
user = winshare_userdom + "/" + winshare_user + "%" + winshare_pass
CC: @svisagan83
INFO: Removing Component IIS_Test_Site from Server inblr-uvm-1118 PLAY [Execute File] **** TASK [Execute File] **** fatal: [inblr-uvm-1118.eu.uis.unisys.com]: FAILED! => {"changed": false, "cmd": "-dellist /tmp/tdm.8589.1.tmp", "msg": "Exception calling \"SearchPath\" with \"1\" argument(s): \"Could not locate the following executable -dellist.exe\"", "rc": 2} to retry, use: --limit @/tmp/tmpabbx7vna/runit.retry PLAY RECAP ***** inblr-uvm-1118.eu.uis.unisys.com : ok=0 changed=0 unreachable=0 failed=1
@piyush94 - added the user domain code and resolved the -dellist parameter error. Please pull latest image
CC: @svisagan83
Pulling files from windows share location, without having to mount it as a filesystem.
CC: @svisagan83