Merge lp:~doanac/lava-dispatcher/config-finding-fix into lp:lava-dispatcher

Proposed by Andy Doan
Status: Rejected
Rejected by: Neil Williams
Proposed branch: lp:~doanac/lava-dispatcher/config-finding-fix
Merge into: lp:lava-dispatcher
Diff against target: 13 lines (+3/-0)
1 file modified
lava/dispatcher/commands.py (+3/-0)
To merge this branch: bzr merge lp:~doanac/lava-dispatcher/config-finding-fix
Reviewer Review Type Date Requested Status
Linaro Validation Team Pending
Review via email: mp+140964@code.launchpad.net

Description of the change

kind of a hack, but allows us to run commands like "lava dispatch" or "lava devices" without having to source the "activate" script.

maybe there's a better way?

To post a comment you must log in.
Revision history for this message
Antonio Terceiro (terceiro) wrote :

On Thu, Dec 20, 2012 at 06:13:26PM -0000, Andy Doan wrote:
> Andy Doan has proposed merging lp:~doanac/lava-dispatcher/config-finding-fix into lp:lava-dispatcher.
>
> Requested reviews:
> Linaro Validation Team (linaro-validation)
>
> For more details, see:
> https://code.launchpad.net/~doanac/lava-dispatcher/config-finding-fix/+merge/140964
>
> kind of a hack, but allows us to run commands like "lava dispatch" or "lava devices" without having to source the "activate" script.
>
> maybe there's a better way?

Do you keep the bin/ directory of the virtualenv in your $PATH?

I don't, and added this to my bashrc:

alias init-lava='. ~/src/lava/.virtualenv/lava/bin/activate'

When I want to run lava commands I just to run `init-lava` before.

--
Antonio Terceiro
Software Engineer - Linaro
http://www.linaro.org

Revision history for this message
Andy Doan (doanac) wrote :

On 12/21/2012 08:01 AM, Antonio Terceiro wrote:
> Do you keep the bin/ directory of the virtualenv in your $PATH?
>
> I don't, and added this to my bashrc:
>
> alias init-lava='. ~/src/lava/.virtualenv/lava/bin/activate'
>
> When I want to run lava commands I just to run `init-lava` before.

The problem is that people are currently installing lava, and then
expecting "lava dispatch" or "lava devices" to work, and they don't.
This patch makes it work out of the box without requiring the user to
alter their environment.

Revision history for this message
Antonio Terceiro (terceiro) wrote :

On Sat, Dec 29, 2012 at 04:37:22PM -0000, Andy Doan wrote:
> On 12/21/2012 08:01 AM, Antonio Terceiro wrote:
> > Do you keep the bin/ directory of the virtualenv in your $PATH?
> >
> > I don't, and added this to my bashrc:
> >
> > alias init-lava='. ~/src/lava/.virtualenv/lava/bin/activate'
> >
> > When I want to run lava commands I just to run `init-lava` before.
>
> The problem is that people are currently installing lava, and then
> expecting "lava dispatch" or "lava devices" to work, and they don't.
> This patch makes it work out of the box without requiring the user to
> alter their environment.

ok, got it now.

 +1

--
Antonio Terceiro
Software Engineer - Linaro
http://www.linaro.org

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Andy Doan <email address hidden> writes:

> Andy Doan has proposed merging lp:~doanac/lava-dispatcher/config-finding-fix into lp:lava-dispatcher.
>
> Requested reviews:
> Linaro Validation Team (linaro-validation)
>
> For more details, see:
> https://code.launchpad.net/~doanac/lava-dispatcher/config-finding-fix/+merge/140964
>
> kind of a hack, but allows us to run commands like "lava dispatch" or "lava devices" without having to source the "activate" script.
>
> maybe there's a better way?

Maybe this counts as better?
https://code.launchpad.net/~mwhudson/lava-manifest/always-set-VIRTUAL_ENV/+merge/141676

Cheers,
mwh

Unmerged revisions

513. By Andy Doan

fix issue when running "lava devices/dispath" without activating env

The dispatcher command code requires VIRTUAL_ENV to be set by
the activate script. This adds a fall-through case in the event
we are a part of a normal lava instal.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lava/dispatcher/commands.py'
2--- lava/dispatcher/commands.py 2012-11-30 19:14:23 +0000
3+++ lava/dispatcher/commands.py 2012-12-20 18:12:20 +0000
4@@ -21,6 +21,9 @@
5 if "VIRTUAL_ENV" in os.environ:
6 default_config_dir = os.path.join(
7 os.environ["VIRTUAL_ENV"], "etc", "lava-dispatcher")
8+ elif sys.argv[0].startswith('/srv/lava/instances'):
9+ dir=os.path.dirname(os.path.dirname(sys.argv[0]))
10+ default_config_dir = os.path.join(dir, "etc", "lava-dispatcher")
11 else:
12 default_config_dir = None
13 parser.add_argument(

Subscribers

People subscribed via source and target branches