Skip to content
This repository has been archived by the owner on Feb 11, 2019. It is now read-only.

Clone needs to be reviewed #22

Open
jwoodcock opened this issue Mar 18, 2014 · 9 comments
Open

Clone needs to be reviewed #22

jwoodcock opened this issue Mar 18, 2014 · 9 comments
Labels

Comments

@jwoodcock
Copy link
Member

Clone seems to be not working properly. When I provide the environment name I want to cloned environment to show up as, I get the following error message:

"Sorry, but that is not a valid environment name."

@jwoodcock jwoodcock added the bug label Mar 18, 2014
@jakerella
Copy link
Member

I cannot reproduce this. Was this using the most recent version? Is there any other steps we can see to reproduce?

@jakerella
Copy link
Member

I was finally able to reproduce this, fresh build, fresh new environment, then the first time I tried to clone I got this:

$ ./virtphp-jk/bin/virtphp clone batbaz foobar
Cloning virtPHP env from /home/jordan/projects/foobar to /home/jordan/projects/batbaz
Copying contents of /home/jordan/projects/foobar to /home/jordan/projects/batbaz
Updating activate file.
Updating PHP ini file.
Updating PHP bin wrapper.
Updating virtual PEAR install and config
Setting proper permissions on cloned bin directory
Error: cloning directory failed.

I was able to clone using sudo ./virtphp-jk/bin/virtphp clone batbaz foobar directly afterward, but attempting to clone without sudo consistently fails at the same place. Seems to be an issue with the permissions on the original environment.

@pddevins
Copy link
Contributor

I have also noticed after running virtphp clone {newEnv} {existingEnv} that the new cloned environment has an incorrect Path when viewing the table in virtphp show. The original environment's path is (for illustration sake) /User/currentuser but the new environment's path is set
to /User/currentuser/{newEnv}. See paste of output below.

~           
▶ virtphp clone new-55 generic-55
Cloning virtPHP env from /Users/pddevins/generic-55 to /Users/pddevins/new-55
Copying contents of /Users/pddevins/generic-55 to /Users/pddevins/new-55
Updating activate file.
Updating PHP ini file.
Updating PHP bin wrapper.
Updating virtual PEAR install and config
Setting proper permissions on cloned bin directory
Getting the contents of current environments file.
Write updated list to environments file.
Your new cloned virtual php environment has been created.
Cloned from: /Users/simplchimp/generic-55
~                                                                                                                                                                 
▶ virtphp show
+------------+--------------------------+-----------------------------------------------------+
| Name       | Path                     | ACTIVATE                                            |
+------------+--------------------------+-----------------------------------------------------+
| generic-55 | /Users/pddevins          | source /Users/pddevins/generic-55/bin/activate      |
| (!)new-55  | /Users/pddevins/new-55   | source /Users/pddevins/new-55/new-55/bin/activate   |
+------------+--------------------------+-----------------------------------------------------+

WARNING: The `new-55` virtPHP environment can no longer be found. Perhaps it has moved or 
has been deleted.

@jakerella
Copy link
Member

Did you initiate the clone command from within the old environment directory (Users/pddevins/generic-55) or from the parent directory (/Users/pddevins)? From what you have above, it looks like the original environment is in /Users/pddevins/generic-55, which means clone should have been run from /Users/pddevins.

Perhaps you could also show us the virtphp-relevant directory structure starting from /Users/pddevins?

@jakerella
Copy link
Member

Ok, looking at this again, is it the case that the "new" environment is in /Users/pddevins/new-55/new-55? Again, if we can see the full directory structure I think that would help. And knowing where you ran the clone command from.

@jwoodcock
Copy link
Member Author

This is good to know and should be looked at when the clone functionality, which is currently broken, gets fixed.

@pddevins
Copy link
Contributor

I ran the clone from the /Users/pddevins directory.
This is the directory structure of the parent environment. (generic-55 is located in /Users/pddevins)

Relevant Directory Structure for Parent Environment

This is the directory structure of the cloned environment. (new-55 is located in /Users/pddevins)

Relevant Directory Structure for Cloned Environment

@jwoodcock
Copy link
Member Author

On OSX, clone is failing due to this error:
Symfony\Component\Filesystem\Exception\IOException: Failed to chmod file "/Users/Kite/.virtphp/envs/oneMore/bin/phpize". in /Users/Kite/work/virtphp/vendor/symfony/filesystem/Symfony/Component/Filesystem/Filesystem.php on line 179

You can add a print_r($e); on line 103 of src/Virtphp/Workers/Cloner.php to see the exact error.

@pddevins
Copy link
Contributor

I just ran through the Cloner process by hand, and I couldn't reproduce the Failed to chmod error. All the chmods seem like they are working correctly. Perhaps it's because you are attempting to clone/create an env in the .virtphp folder? What is the permissions of the .virtphp recursive file tree?

I am, however, seeing the following issue as I step through the Cloner:

When creating a new environment, a new record is inserted into the .virtphp/environment.json file with the Environment name set as $this->getEnvName() and the Path name set as $this->getEnvBasePath(). However, when cloning an environment the Environment name and Path name are set with $this->envName and $this->realPath. The issue is that $this->getEnvBasePath() returns the path TO the envName folder, but $this->realPath returns the path WITH the envName folder. I think this is confusing the Shower Worker on line 87 when the sourceBase is being built with the $value['path'] . DS . $key, which translates to $HOME/env1 in the original env (line 269 in Workers/Creator.php) and $HOME/clone1/clone1 in the cloned env (line 255 in Workers/Cloner.php) because the path is being written as $HOME/clone1 and the envName is clone1.

ramsey added a commit that referenced this issue May 3, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants