Discussion:
[rancid] Setting up rancid with a corp svn server?
John A. Kilpatrick
2008-12-02 23:55:03 UTC
Permalink
My boss wants me to have rancid use our corporate svn server. Shouldn't
be a problem right? :)

So I went and made /data/rancid as the base dir. I checked out the tree
using svn co https://svn.foo.com/svn/is-ops is-ops and got the tree we
use.

I have the basedir set to /data/rancid and I have CVSROOT set to
/data//rancid/is-ops/trunk/doc/network/Configs which is where I'd like the
files to go.

Then I ran rancid-cvs and got:

***@ntop /data/rancid $ rancid-cvs
svn: Unable to open an ra_local session to URL
svn: Unable to open repository
'file:///data/rancid/is-ops/trunk/doc/network/Configs/prod'
svn: Unable to open an ra_local session to URL
svn: Unable to open repository
'file:///data/rancid/is-ops/trunk/doc/network/Configs/prod'
svn: '.' is not a working copy
svn: Can't open file '.svn/entries': No such file or directory
svn: '/data/rancid/prod/configs' is not a working copy
svn: '.' is not a working copy
svn: Can't open file '.svn/entries': No such file or directory
svn: '/data/rancid/prod' is not a working copy
svn: Can't open file '/data/rancid/prod/.svn/entries': No such file or
directory
svn: Unable to open an ra_local session to URL
svn: Unable to open repository
'file:///data/rancid/is-ops/trunk/doc/network/Configs/corp'
svn: Unable to open an ra_local session to URL
svn: Unable to open repository
'file:///data/rancid/is-ops/trunk/doc/network/Configs/corp'
svn: '.' is not a working copy
svn: Can't open file '.svn/entries': No such file or directory
svn: '/data/rancid/corp/configs' is not a working copy
svn: '.' is not a working copy
svn: Can't open file '.svn/entries': No such file or directory
svn: '/data/rancid/corp' is not a working copy
svn: Can't open file '/data/rancid/corp/.svn/entries': No such file or
directory

I'll be honest, I'm not an svn guru nor am I rancid guru - rancid always
falls under the "just works" category for me. If someone can point out
what I'm doing wrong I'd appreciate it. Should the CVS basedir be a URL?

Thanks,
John
--
John A. Kilpatrick
***@hypergeek.net Email| http://www.hypergeek.net/
john-***@hypergeek.net Text pages| ICQ: 19147504
remember: no obstacles/only challenges
john heasley
2008-12-03 23:30:43 UTC
Permalink
Post by John A. Kilpatrick
My boss wants me to have rancid use our corporate svn server. Shouldn't
be a problem right? :)
So I went and made /data/rancid as the base dir. I checked out the tree
using svn co https://svn.foo.com/svn/is-ops is-ops and got the tree we
use.
I have the basedir set to /data/rancid and I have CVSROOT set to
/data//rancid/is-ops/trunk/doc/network/Configs which is where I'd like the
files to go.
svn: Unable to open an ra_local session to URL
svn: Unable to open repository
'file:///data/rancid/is-ops/trunk/doc/network/Configs/prod'
svn: Unable to open an ra_local session to URL
svn: Unable to open repository
'file:///data/rancid/is-ops/trunk/doc/network/Configs/prod'
rancid-cvs assume that CVSROOT (from rancid.conf) is local and is a
path not a URL and in some cases svn wants a path and in others a
URL.

To support this, i think CVSROOT would have to become a url.
Post by John A. Kilpatrick
svn: '.' is not a working copy
svn: Can't open file '.svn/entries': No such file or directory
svn: '/data/rancid/prod/configs' is not a working copy
svn: '.' is not a working copy
svn: Can't open file '.svn/entries': No such file or directory
svn: '/data/rancid/prod' is not a working copy
svn: Can't open file '/data/rancid/prod/.svn/entries': No such file or
directory
svn: Unable to open an ra_local session to URL
svn: Unable to open repository
'file:///data/rancid/is-ops/trunk/doc/network/Configs/corp'
svn: Unable to open an ra_local session to URL
svn: Unable to open repository
'file:///data/rancid/is-ops/trunk/doc/network/Configs/corp'
svn: '.' is not a working copy
svn: Can't open file '.svn/entries': No such file or directory
svn: '/data/rancid/corp/configs' is not a working copy
svn: '.' is not a working copy
svn: Can't open file '.svn/entries': No such file or directory
svn: '/data/rancid/corp' is not a working copy
svn: Can't open file '/data/rancid/corp/.svn/entries': No such file or
directory
I'll be honest, I'm not an svn guru nor am I rancid guru - rancid always
falls under the "just works" category for me. If someone can point out
what I'm doing wrong I'd appreciate it. Should the CVS basedir be a URL?
Thanks,
John
--
John A. Kilpatrick
remember: no obstacles/only challenges
_______________________________________________
Rancid-discuss mailing list
http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss
Peter Serwe
2008-12-04 00:20:38 UTC
Permalink
Wouldn't you then have to change how rancid-cvs handles that variable?

It would seem that you would have to figure out how to tell rancid that the repo
was already created and how to reference it. The thing is, you can't
write files directly
to the remote repo, you have to work off a checked out version of it.
Rancid basically does
this already, and for all intents and purposes, once the repo(s) are
properly created, you
should be able to do svn ci all you want in the checked out directory
like rancid does already.

Maybe there's a way to create the directories local with rancid-cvs
and then swap in the remote
repo after the fact, by removing the directories, checking out the
remote repo into the same directory
names, and then run rancid.

It would seem like that could work.

Peter
Post by john heasley
Post by John A. Kilpatrick
My boss wants me to have rancid use our corporate svn server. Shouldn't
be a problem right? :)
So I went and made /data/rancid as the base dir. I checked out the tree
using svn co https://svn.foo.com/svn/is-ops is-ops and got the tree we
use.
I have the basedir set to /data/rancid and I have CVSROOT set to
/data//rancid/is-ops/trunk/doc/network/Configs which is where I'd like the
files to go.
svn: Unable to open an ra_local session to URL
svn: Unable to open repository
'file:///data/rancid/is-ops/trunk/doc/network/Configs/prod'
svn: Unable to open an ra_local session to URL
svn: Unable to open repository
'file:///data/rancid/is-ops/trunk/doc/network/Configs/prod'
rancid-cvs assume that CVSROOT (from rancid.conf) is local and is a
path not a URL and in some cases svn wants a path and in others a
URL.
To support this, i think CVSROOT would have to become a url.
Post by John A. Kilpatrick
svn: '.' is not a working copy
svn: Can't open file '.svn/entries': No such file or directory
svn: '/data/rancid/prod/configs' is not a working copy
svn: '.' is not a working copy
svn: Can't open file '.svn/entries': No such file or directory
svn: '/data/rancid/prod' is not a working copy
svn: Can't open file '/data/rancid/prod/.svn/entries': No such file or
directory
svn: Unable to open an ra_local session to URL
svn: Unable to open repository
'file:///data/rancid/is-ops/trunk/doc/network/Configs/corp'
svn: Unable to open an ra_local session to URL
svn: Unable to open repository
'file:///data/rancid/is-ops/trunk/doc/network/Configs/corp'
svn: '.' is not a working copy
svn: Can't open file '.svn/entries': No such file or directory
svn: '/data/rancid/corp/configs' is not a working copy
svn: '.' is not a working copy
svn: Can't open file '.svn/entries': No such file or directory
svn: '/data/rancid/corp' is not a working copy
svn: Can't open file '/data/rancid/corp/.svn/entries': No such file or
directory
I'll be honest, I'm not an svn guru nor am I rancid guru - rancid always
falls under the "just works" category for me. If someone can point out
what I'm doing wrong I'd appreciate it. Should the CVS basedir be a URL?
Thanks,
John
--
John A. Kilpatrick
remember: no obstacles/only challenges
_______________________________________________
Rancid-discuss mailing list
http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss
_______________________________________________
Rancid-discuss mailing list
http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss
--
$B%T!<%?!<(B
John A. Kilpatrick
2008-12-04 01:47:55 UTC
Permalink
Post by john heasley
rancid-cvs assume that CVSROOT (from rancid.conf) is local and is a
path not a URL and in some cases svn wants a path and in others a
URL.
To support this, i think CVSROOT would have to become a url.
Yeah, I may have to hack that manually, given that in racid-cvs, for
example, $CVSROOT is prefaces by file://
--
John A. Kilpatrick
***@hypergeek.net Email| http://www.hypergeek.net/
john-***@hypergeek.net Text pages| ICQ: 19147504
remember: no obstacles/only challenges
Peter Serwe
2008-12-04 02:01:59 UTC
Permalink
Interesting.

So, if it were to be a pretty clean hack, i.e.: Something that could
be committed to the source tree,
perhaps we should have another variable like CVSMETHOD where we could
put in https, ssh, or file
and have it populate another variable based on that input.

I'm assuming from the earlier part of the thread, you're planning to
use https, IIRC.

Peter
Post by John A. Kilpatrick
Post by john heasley
rancid-cvs assume that CVSROOT (from rancid.conf) is local and is a
path not a URL and in some cases svn wants a path and in others a
URL.
To support this, i think CVSROOT would have to become a url.
Yeah, I may have to hack that manually, given that in racid-cvs, for
example, $CVSROOT is prefaces by file://
--
John A. Kilpatrick
remember: no obstacles/only challenges
_______________________________________________
Rancid-discuss mailing list
http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss
--
$B%T!<%?!<(B
Karsten Heymann
2008-12-04 06:42:46 UTC
Permalink
Hi,
So, if it were to be a pretty clean hack, i.e.: Something that could
be committed to the source tree
I solved this problem with the following trivial patch to
rancid-cvs.in (in debian dpatch format, but should be usable by others
too). Feel free to include it into the source tree. The idea is to
test if CVSROOT contains the characters ://, and, depending on that,
behave differently.

hth,
Karsten

#! /bin/sh /usr/share/dpatch/dpatch-run
## 07_svn_remote.dpatch by <***@gmx.de>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Add support for remote subversion repositories

@DPATCH@
diff -urNad rancid-2.3.2~a8~/bin/rancid-cvs.in rancid-2.3.2~a8/bin/rancid-cvs.in
--- rancid-2.3.2~a8~/bin/rancid-cvs.in 2008-02-08 07:28:29.000000000 +0100
+++ rancid-2.3.2~a8/bin/rancid-cvs.in 2008-09-26 08:51:18.000000000 +0200
@@ -97,7 +97,9 @@
if [ $RCSSYS = cvs ]; then
cvs -d $CVSROOT init
else
- svnadmin create $CVSROOT @SVN_FSTYPE@
+ if [[ $(expr match $CVSROOT '.*://') -eq 0 ]]; then
+ svnadmin create $CVSROOT @SVN_FSTYPE@
+ fi
fi
fi

@@ -127,10 +129,16 @@
cvs import -m "$GROUP" $GROUP new rancid
cd $BASEDIR
cvs checkout $GROUP
- else
+
+ # local subversion repository:
+ elif [[ $(expr match $CVSROOT '.*://') -eq 0 ]]; then
svn import -m "$GROUP" . file://$CVSROOT/$GROUP
cd $BASEDIR
svn checkout file://$CVSROOT/$GROUP $GROUP
+ else # remote subversion repository
+ svn import -m "$GROUP" . $CVSROOT/$GROUP
+ cd $BASEDIR
+ svn checkout $CVSROOT/$GROUP $GROUP
fi
fi
cd $DIR
--
Karsten Heymann
john heasley
2008-12-04 19:22:30 UTC
Permalink
Post by Karsten Heymann
Hi,
So, if it were to be a pretty clean hack, i.e.: Something that could
be committed to the source tree
I solved this problem with the following trivial patch to
rancid-cvs.in (in debian dpatch format, but should be usable by others
too). Feel free to include it into the source tree. The idea is to
test if CVSROOT contains the characters ://, and, depending on that,
behave differently.
hth,
Karsten
Nice, thats the idea. It'd be less confusing to deal with CVSROOT always
being a URL, while also accepting a normal path.
Post by Karsten Heymann
#! /bin/sh /usr/share/dpatch/dpatch-run
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Add support for remote subversion repositories
@DPATCH@
diff -urNad rancid-2.3.2~a8~/bin/rancid-cvs.in rancid-2.3.2~a8/bin/rancid-cvs.in
--- rancid-2.3.2~a8~/bin/rancid-cvs.in 2008-02-08 07:28:29.000000000 +0100
+++ rancid-2.3.2~a8/bin/rancid-cvs.in 2008-09-26 08:51:18.000000000 +0200
@@ -97,7 +97,9 @@
if [ $RCSSYS = cvs ]; then
cvs -d $CVSROOT init
else
+ if [[ $(expr match $CVSROOT '.*://') -eq 0 ]]; then
+ fi
fi
fi
@@ -127,10 +129,16 @@
cvs import -m "$GROUP" $GROUP new rancid
cd $BASEDIR
cvs checkout $GROUP
- else
+
+ elif [[ $(expr match $CVSROOT '.*://') -eq 0 ]]; then
svn import -m "$GROUP" . file://$CVSROOT/$GROUP
cd $BASEDIR
svn checkout file://$CVSROOT/$GROUP $GROUP
+ else # remote subversion repository
+ svn import -m "$GROUP" . $CVSROOT/$GROUP
+ cd $BASEDIR
+ svn checkout $CVSROOT/$GROUP $GROUP
fi
fi
cd $DIR
--
Karsten Heymann
_______________________________________________
Rancid-discuss mailing list
http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss
Tom Duijf
2008-12-04 07:54:42 UTC
Permalink
Rancid uses a local svn/cvs repository and and a local working
copy/checkout.
The trick is to just ignore the local repos and make a working copy from
the corporate server yourself using a separate local user so svn can
safely store its repos credentials. Svn store their own repos path, the
one in the rancid config file is only for initial creation.

Install rancid in a normal way, have it set up the local repos and
working copy (without switches, just the basic dir layout).
Rancid only uses the local repos path when there is no working copy set
up. After this, just temp copy the working copy contents (remove the
.svn dirs) and check out a new empty dir from our corp repos.

I have rancid setup to use a department svn server where we not just
store network device configs but also several sets of server
configuration, committed by a separate set of scripts. All works like a
charm.

Kind regards,
Tom Duijf
Post by John A. Kilpatrick
My boss wants me to have rancid use our corporate svn server. Shouldn't
be a problem right? :)
So I went and made /data/rancid as the base dir. I checked out the tree
using svn co https://svn.foo.com/svn/is-ops is-ops and got the tree we
use.
I have the basedir set to /data/rancid and I have CVSROOT set to
/data//rancid/is-ops/trunk/doc/network/Configs which is where I'd like the
files to go.
svn: Unable to open an ra_local session to URL
svn: Unable to open repository
'file:///data/rancid/is-ops/trunk/doc/network/Configs/prod'
svn: Unable to open an ra_local session to URL
svn: Unable to open repository
'file:///data/rancid/is-ops/trunk/doc/network/Configs/prod'
svn: '.' is not a working copy
svn: Can't open file '.svn/entries': No such file or directory
svn: '/data/rancid/prod/configs' is not a working copy
svn: '.' is not a working copy
svn: Can't open file '.svn/entries': No such file or directory
svn: '/data/rancid/prod' is not a working copy
svn: Can't open file '/data/rancid/prod/.svn/entries': No such file or
directory
svn: Unable to open an ra_local session to URL
svn: Unable to open repository
'file:///data/rancid/is-ops/trunk/doc/network/Configs/corp'
svn: Unable to open an ra_local session to URL
svn: Unable to open repository
'file:///data/rancid/is-ops/trunk/doc/network/Configs/corp'
svn: '.' is not a working copy
svn: Can't open file '.svn/entries': No such file or directory
svn: '/data/rancid/corp/configs' is not a working copy
svn: '.' is not a working copy
svn: Can't open file '.svn/entries': No such file or directory
svn: '/data/rancid/corp' is not a working copy
svn: Can't open file '/data/rancid/corp/.svn/entries': No such file or
directory
I'll be honest, I'm not an svn guru nor am I rancid guru - rancid always
falls under the "just works" category for me. If someone can point out
what I'm doing wrong I'd appreciate it. Should the CVS basedir be a URL?
Thanks,
John
Loading...