Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation to help users execute fab from command line #89

Closed
velocirobbie opened this issue Feb 27, 2019 · 6 comments

Comments

@velocirobbie
Copy link
Collaborator

commented Feb 27, 2019

This has been a complaint with a few alpha users where they can't execute fab commands, i.e. fab command is not in their $PATH

I imagine this will always be something to do with an abnormal python install, so maybe not our problem but could consider adding some help for such users.

@arabnejad

This comment has been minimized.

Copy link
Collaborator

commented Feb 27, 2019

Hi @velocirobbie

maybe by redirecting the fab execution, we can fix it for now without requiring to make any further changes in the machines.yml or machines_user.yml
you just need to add these function into your ~/.bashrc file, and load it by source ~/.bashrc

function fab { 
	curr_pwd=$PWD;
	cd <PATH to FabSim3 folder>;
	command fab  $@; 
	cd $curr_pwd;
}
  • replace <PATH to FabSim3 folder> with the path in your local machine

check this if it works for you ?

what do you think about this solution @djgroen ?

@velocirobbie

This comment has been minimized.

Copy link
Collaborator Author

commented Feb 28, 2019

I think this is a fix for a different issue.
One of the alpha users in the M6 feedback, and I remember some happening before, would get a fab command-not-found error. The problem I think you are addressing is that you have to be in the fab directory tree to use fabsim functions.
Problem here is that I can't remember how we fixed it, but i think it was something to do with people having multiple python installations (???). Therefore when they 'pip install fab' the fab command wasn't installed correctly. I was thinking something more like adding a line to install.md:

If you get an command-not-found fab error, you fabric installation was not configured correctly. The fab command must be accesible on the command line. Check it is available in your $PATH and that there are no python environment clashes.

or similar, what do you think?

@arabnejad

This comment has been minimized.

Copy link
Collaborator

commented Feb 28, 2019

ok, but what do you mean fab command wasn't installed correctly ? the installation was done correctly but did not added to the PATH, am I right ?
in that case, we can run

$ find / -type f -name "fab" 2> >(grep -v 'Permission denied' >&2)
/usr/bin/fab
/home/hamid/.local/bin/fab

or use find / -type f -name "fab" 2> >(grep -v 'Permission denied' >&2) | xargs | sed -e 's/ /:/g' to concat the output with ;, also we can provide a single line to add it to $PATH

does that sound acceptable ?

also, it can be done by awk

also, the previous suggested solution for Fatal error: Couldn't find any fabfiles! can be handled by using -f option (command fab <fabsim_folder_path>/fabfile.py $@), but personally I prefer using cdcommand to be sure we are in the correct fabsim folder to avoid any further issue

@djgroen

This comment has been minimized.

Copy link
Owner

commented Mar 1, 2019

@arabnejad

In regards to your first command, perhaps we can wrap that in a simple bash script named where_is_fab.sh, which then provides the paths to the fab command, as well as instructions how users can add this to their .bashrc or .profile files?

The script could be placed in the home directory.

As for your last remark, I fully agree. It's best if the users cd to the FabSim installation before running fab commands. Anything else will become messy whenever users have multiple FabSim installations.

@djgroen

This comment has been minimized.

Copy link
Owner

commented Jun 10, 2019

Hi both,

I have a better solution for this in the derek-better-fab branch.

We'll change the base command from fab to fabsim, and simply provide it in $FabSimHome/bin.

That way we won't have this mess again :).

@djgroen

This comment has been minimized.

Copy link
Owner

commented Jun 10, 2019

I am going to close this issue now, though we'll have to decide whether to merge in this branch or not.

@djgroen djgroen closed this Jun 10, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.