Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
helm3
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
helm3
Commits
acfc6054
Commit
acfc6054
authored
Mar 27, 2016
by
jackgr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disambiguate method names
parent
04dc6705
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
56 deletions
+20
-56
chartrepos.go
cmd/manager/chartrepos.go
+4
-40
manager.go
cmd/manager/manager/manager.go
+12
-12
testutil.go
cmd/manager/testutil.go
+4
-4
No files found.
cmd/manager/chartrepos.go
View file @
acfc6054
...
...
@@ -39,7 +39,7 @@ func registerChartRepoRoutes(c *router.Context, h *router.Handler) {
func
listChartReposHandlerFunc
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
,
c
*
router
.
Context
)
error
{
handler
:=
"manager: list chart repositories"
repos
,
err
:=
c
.
Manager
.
List
Chart
Repos
()
repos
,
err
:=
c
.
Manager
.
ListRepos
()
if
err
!=
nil
{
return
err
}
...
...
@@ -58,7 +58,7 @@ func addChartRepoHandlerFunc(w http.ResponseWriter, r *http.Request, c *router.C
return
nil
}
if
err
:=
c
.
Manager
.
Add
Chart
Repo
(
cr
);
err
!=
nil
{
if
err
:=
c
.
Manager
.
AddRepo
(
cr
);
err
!=
nil
{
httputil
.
BadRequest
(
w
,
r
,
err
)
return
nil
}
...
...
@@ -77,7 +77,7 @@ func removeChartRepoHandlerFunc(w http.ResponseWriter, r *http.Request, c *route
return
err
}
err
=
c
.
Manager
.
Remove
Chart
Repo
(
name
)
err
=
c
.
Manager
.
RemoveRepo
(
name
)
if
err
!=
nil
{
return
err
}
...
...
@@ -95,7 +95,7 @@ func getChartRepoHandlerFunc(w http.ResponseWriter, r *http.Request, c *router.C
return
err
}
cr
,
err
:=
c
.
Manager
.
Get
Chart
Repo
(
repoURL
)
cr
,
err
:=
c
.
Manager
.
GetRepo
(
repoURL
)
if
err
!=
nil
{
httputil
.
BadRequest
(
w
,
r
,
err
)
return
nil
...
...
@@ -159,39 +159,3 @@ func getRepoChartHandlerFunc(w http.ResponseWriter, r *http.Request, c *router.C
util
.
LogHandlerExitWithJSON
(
handler
,
w
,
repoChart
,
http
.
StatusOK
)
return
nil
}
func
addChartRepoHandlerFunc
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
,
c
*
router
.
Context
)
error
{
handler
:=
"manager: add chart repository"
util
.
LogHandlerEntry
(
handler
,
r
)
defer
r
.
Body
.
Close
()
cr
:=
&
repo
.
Repo
{}
if
err
:=
httputil
.
Decode
(
w
,
r
,
cr
);
err
!=
nil
{
httputil
.
BadRequest
(
w
,
r
,
err
)
return
nil
}
if
err
:=
c
.
Manager
.
AddChartRepo
(
cr
);
err
!=
nil
{
httputil
.
BadRequest
(
w
,
r
,
err
)
return
nil
}
util
.
LogHandlerExitWithText
(
handler
,
w
,
"added"
,
http
.
StatusOK
)
return
nil
}
func
removeChartRepoHandlerFunc
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
,
c
*
router
.
Context
)
error
{
handler
:=
"manager: remove chart repository"
util
.
LogHandlerEntry
(
handler
,
r
)
URL
,
err
:=
pos
(
w
,
r
,
2
)
if
err
!=
nil
{
return
err
}
err
=
c
.
Manager
.
RemoveChartRepo
(
URL
)
if
err
!=
nil
{
return
err
}
util
.
LogHandlerExitWithText
(
handler
,
w
,
"removed"
,
http
.
StatusOK
)
return
nil
}
cmd/manager/manager/manager.go
View file @
acfc6054
...
...
@@ -58,10 +58,10 @@ type Manager interface {
GetCredential
(
name
string
)
(
*
repo
.
Credential
,
error
)
// Chart Repositories
List
Chart
Repos
()
(
map
[
string
]
string
,
error
)
Add
Chart
Repo
(
addition
repo
.
IRepo
)
error
Remove
Chart
Repo
(
name
string
)
error
Get
Chart
Repo
(
URL
string
)
(
repo
.
IRepo
,
error
)
ListRepos
()
(
map
[
string
]
string
,
error
)
AddRepo
(
addition
repo
.
IRepo
)
error
RemoveRepo
(
name
string
)
error
GetRepo
(
URL
string
)
(
repo
.
IRepo
,
error
)
}
type
manager
struct
{
...
...
@@ -366,18 +366,18 @@ func (m *manager) GetChart(reference string) (*chart.Chart, error) {
return
c
,
nil
}
// List
ChartRepos returns the list of available chart
repository URLs
func
(
m
*
manager
)
List
Chart
Repos
()
(
map
[
string
]
string
,
error
)
{
// List
Repos returns the list of available
repository URLs
func
(
m
*
manager
)
ListRepos
()
(
map
[
string
]
string
,
error
)
{
return
m
.
service
.
ListRepos
()
}
// Add
ChartRepo adds a chart
repository to the list
func
(
m
*
manager
)
Add
Chart
Repo
(
addition
repo
.
IRepo
)
error
{
// Add
Repo adds a
repository to the list
func
(
m
*
manager
)
AddRepo
(
addition
repo
.
IRepo
)
error
{
return
m
.
service
.
CreateRepo
(
addition
)
}
// Remove
ChartRepo removes a chart
repository from the list by URL
func
(
m
*
manager
)
Remove
Chart
Repo
(
name
string
)
error
{
// Remove
Repo removes a
repository from the list by URL
func
(
m
*
manager
)
RemoveRepo
(
name
string
)
error
{
url
,
err
:=
m
.
service
.
GetRepoURLByName
(
name
)
if
err
!=
nil
{
return
err
...
...
@@ -385,8 +385,8 @@ func (m *manager) RemoveChartRepo(name string) error {
return
m
.
service
.
DeleteRepo
(
url
)
}
// Get
ChartRepo returns the chart
repository with the given URL
func
(
m
*
manager
)
Get
Chart
Repo
(
URL
string
)
(
repo
.
IRepo
,
error
)
{
// Get
Repo returns the
repository with the given URL
func
(
m
*
manager
)
GetRepo
(
URL
string
)
(
repo
.
IRepo
,
error
)
{
return
m
.
service
.
GetRepoByURL
(
URL
)
}
...
...
cmd/manager/testutil.go
View file @
acfc6054
...
...
@@ -119,19 +119,19 @@ func (m *mockManager) GetChart(chartName string) (*chart.Chart, error) {
return
nil
,
nil
}
func
(
m
*
mockManager
)
Add
Chart
Repo
(
addition
repo
.
IRepo
)
error
{
func
(
m
*
mockManager
)
AddRepo
(
addition
repo
.
IRepo
)
error
{
return
nil
}
func
(
m
*
mockManager
)
List
Chart
Repos
()
(
map
[
string
]
string
,
error
)
{
func
(
m
*
mockManager
)
ListRepos
()
(
map
[
string
]
string
,
error
)
{
return
map
[
string
]
string
{},
nil
}
func
(
m
*
mockManager
)
Remove
Chart
Repo
(
name
string
)
error
{
func
(
m
*
mockManager
)
RemoveRepo
(
name
string
)
error
{
return
nil
}
func
(
m
*
mockManager
)
Get
Chart
Repo
(
URL
string
)
(
repo
.
IRepo
,
error
)
{
func
(
m
*
mockManager
)
GetRepo
(
URL
string
)
(
repo
.
IRepo
,
error
)
{
return
nil
,
nil
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment