6 Replies Latest reply on Jul 18, 2014 7:11 AM by Bill Robinson

    Blcli FileTransfer not maintaining file permissions

    Fernando Castro Guti�rrez de Quevedo

      Hi,

       

      I have a Linux server in which I have a CSV file ( //ip_address/tmp/output_file.csv ) owned by root user and group (Tried with modes 0700, 0644 and 0777) . Using a blcli, said file is copied to Bladelogic File Server, to a certain folder where all the projects are saved to. Despite the file is actually copied, its permissions get changed to 0700, so a blcli (bulkSetServerPropertyValues) that follows the file copy is not able to read the copied file, and gives the following error:

       

      BLCLIError: com.bladelogic.om.infra.mfw.util.BlException: java.io.FileNotFoundException: /bladelogic/projects/Group_LS/LS_Group_bulk.csv (Permission denied)

       

      The mode as stated by Bladelogic is 0700, with no way to make it readable by other than root, and thus the blcli. This is the first time I have seen something like this

       

      Thanks

        • 1. Re: Blcli FileTransfer not maintaining file permissions
          Rajeev Gupta

          The file permissions are only applicable till its in one server. Once moved to other, it acquires the permissions of the folder its being copied into depending on the user moving it. Since its moved by BLCLI, it acquires ROOT permissions only for 0700.

           

          You can include to change permissions in the same BLCLI NSH script:

          eg:

          chmod 0777 $FILE

          • 2. Re: Blcli FileTransfer not maintaining file permissions
            Bill Robinson

            can you clarify what command you are running, from where and what local user ?

            • 3. Re: Re: Blcli FileTransfer not maintaining file permissions
              Fernando Castro Guti�rrez de Quevedo

              I'll explain what am I doing:

               

              In this Python development server I'm running as root a Python script such as the following

               

                  blcli = jli.get_JLI()

                  blcli.set_profile('SPAIN_DEV')

                  blcli.set_role('BLAdmins_A')

                  command = ['FileTransfer', 'copySvrToSvr', 'null', '//180.133.160.43' + local_output_path, output_csv_path ]

                  blcli.connect_blade()

                  result = blcli.run(command)

              local file at //180.133.160.43/tmp/file.csv is owned by root user and group with mode 0644 gets copied to Bladelogic's fileserver (output_csv_path).

              However, once in said fileserver the mode gets changed to 0700, and then this blcli:

              blcli = jli.get_JLI()
              

              blcli.set_profile('SPAIN_DEV')

              blcli.set_role('BLAdmins_A')

              command = ['Server', 'bulkSetServerPropertyValues', output_csv_path]

              blcli.connect_blade()

              result = blcli.run(command)

              Throws this error message:

               

              BLCLIError: com.bladelogic.om.infra.mfw.util.BlException: java.io.FileNotFoundException: /bladelogic/xxxx/General_AdminBL/Group_LS_by_BS_TS_SC/LS_Group_bulk.csv (Permission denied)

               

              As I'm running on Python, I can't use chmod in a remote server. Also found a blcli that would seem to do the job (FileSystemObject setMode) which accepts only an integer but doesn't seem to work as I thought.

               

              I'd appreciate if you could shed some light on this as it's the only stopper this project has had so far and once this is solved everything would be finally done. Thanks.

              • 4. Re: Re: Blcli FileTransfer not maintaining file permissions
                Bill Robinson

                so why are you doing this ? you are copying a file to the file server and then running the 'bulkSetServerPropertyValues'.  why don't you run that command from your client system?  why are you trying to copy the csv to the file server?

                • 5. Re: Re: Re: Blcli FileTransfer not maintaining file permissions
                  Fernando Castro Guti�rrez de Quevedo

                  I tried that but it seems that the blcli tries to get the file from the file server although I include the source IP in the path. (I moved renamed the file

                  My blcli would be:

                  blcli_execute Server bulkSetServerPropertyValues //180.133.160.43/bulk.csv

                  But then, an error appears:

                  Command execution failed. com.bladelogic.om.infra.mfw.util.BlException: java.io.FileNotFoundException: /bulk.csv (No such file or directory)

                  However, if I manually put this file in the fileserver with appropriate permissions, same path, the command seems to find that file (Although not in the server I told it, but in the fileserver) and run as expected. Obviously this is not the expected behaviour as I would need to copy the file back and edit its permissions, which is what I was trying to do until now.

                   

                  May this be a bug?

                  • 6. Re: Blcli FileTransfer not maintaining file permissions
                    Bill Robinson

                    The blcli will use the file from your local system.  so if you run the blcli on your workstation and you have your bulk import file in /home/user/bulk.csv you can run

                     

                    Blcli_execute Server bulkSetServerPropertyValues /home/user/bulk.csv.