mirror: Do not verify for deprecated recursive URLs

This commit is contained in:
Harshavardhana
2015-11-18 20:24:31 -08:00
parent 22b409f535
commit b36ae24f86
3 changed files with 3 additions and 32 deletions
-9
View File
@@ -164,15 +164,6 @@ func (s *TestSuite) TestNewConfigV6(c *C) {
}
}
func (s *TestSuite) TestRecursiveURL(c *C) {
c.Assert(isURLRecursive("url..."), Equals, true)
c.Assert(isURLRecursive("url.."), Equals, false)
c.Assert(stripRecursiveURL("url..."), Equals, "url")
c.Assert(stripRecursiveURL("url.."), Equals, "url..")
c.Assert(stripRecursiveURL("..."), Equals, ".")
c.Assert(stripRecursiveURL("...url"), Equals, "...url")
}
func (s *TestSuite) TestHostConfig(c *C) {
hostcfg, err := getHostConfig("https://s3.amazonaws.com")
c.Assert(err, IsNil)
+3 -13
View File
@@ -52,14 +52,6 @@ func checkMirrorSyntax(ctx *cli.Context) {
cli.ShowCommandHelpAndExit(ctx, "mirror", 1) // last argument is exit code.
}
// Check if any of the arg is recursive type.
for _, arg := range ctx.Args() {
// Recursive URLs are not allowed in target.
if isURLRecursive(arg) {
fatalIf(errDummy().Trace(), fmt.Sprintf("Recursive option is not supported for target ‘%s’ argument.", arg))
}
}
// extract URLs.
URLs, err := args2URLs(ctx.Args())
fatalIf(err.Trace(ctx.Args()...), "Unable to parse arguments.")
@@ -68,11 +60,9 @@ func checkMirrorSyntax(ctx *cli.Context) {
tgtURLs := URLs[1:]
/****** Generic rules *******/
// Recursive source URL.
newSrcURL := stripRecursiveURL(srcURL)
_, srcContent, err := url2Stat(newSrcURL)
if err != nil && !prefixExists(newSrcURL) {
fatalIf(err.Trace(srcURL), "Unable to stat source ‘"+newSrcURL+"’.")
_, srcContent, err := url2Stat(srcURL)
if err != nil && !prefixExists(srcURL) {
fatalIf(err.Trace(srcURL), "Unable to stat source ‘"+srcURL+"’.")
}
if err == nil && !srcContent.Type.IsDir() {
-10
View File
@@ -38,16 +38,6 @@ func (s *TestSuite) TestURLJoinPath(c *C) {
c.Assert(url, Equals, "http://s3.mycompany.io/dev/mybucket/bin/")
}
func (s *TestSuite) TestStripRecursiveURL(c *C) {
// Strip ‘...’ excluding trailing ‘/’
url := stripRecursiveURL("http://s3.mycompany.io/dev/...")
c.Assert(url, Equals, "http://s3.mycompany.io/dev/")
// Strip ‘...‘
url = stripRecursiveURL("http://s3.mycompany.io/test...")
c.Assert(url, Equals, "http://s3.mycompany.io/test")
}
func (s *TestSuite) TestURL2DirContent(c *C) {
_, err := url2DirContent(".")
c.Assert(err, IsNil)