Commit 8ba0eb4f authored by vaikas-google's avatar vaikas-google

Add support for helm packages. Quite hacky in parts, needs to resolve naming collisions

parent 62f19486
...@@ -214,7 +214,6 @@ func execute() { ...@@ -214,7 +214,6 @@ func execute() {
// Type is most likely a primitive. // Type is most likely a primitive.
tUrl = args[1] tUrl = args[1]
} else { } else {
// TODO(vaikas): Support packages properly.
tUrl = tUrls[0] tUrl = tUrls[0]
} }
path := fmt.Sprintf("types/%s/instances", url.QueryEscape(tUrl)) path := fmt.Sprintf("types/%s/instances", url.QueryEscape(tUrl))
......
resources:
- name: cassandra
type: github.com/helm/charts/cassandra
properties: null
...@@ -50,12 +50,12 @@ def Expand(config, imports=None, env=None, validate_schema=False): ...@@ -50,12 +50,12 @@ def Expand(config, imports=None, env=None, validate_schema=False):
Raises: Raises:
ExpansionError: if there is any error occurred during expansion ExpansionError: if there is any error occurred during expansion
""" """
try: # try:
return _Expand(config, imports=imports, env=env, return _Expand(config, imports=imports, env=env,
validate_schema=validate_schema) validate_schema=validate_schema)
except Exception as e: # except Exception as e:
# print traceback.format_exc() # print traceback.format_exc()
raise ExpansionError('config', str(e)) # raise ExpansionError('config', str(e))
def _Expand(config, imports=None, env=None, validate_schema=False): def _Expand(config, imports=None, env=None, validate_schema=False):
......
...@@ -18,6 +18,7 @@ package manager ...@@ -18,6 +18,7 @@ package manager
import ( import (
"fmt" "fmt"
"log"
"net/http" "net/http"
"time" "time"
...@@ -68,6 +69,7 @@ func resolverError(c *common.Configuration, err error) error { ...@@ -68,6 +69,7 @@ func resolverError(c *common.Configuration, err error) error {
} }
func performHTTPGet(g util.HTTPClient, u string, allowMissing bool) (content string, err error) { func performHTTPGet(g util.HTTPClient, u string, allowMissing bool) (content string, err error) {
log.Printf("Fetching %s", u)
r, code, err := g.Get(u) r, code, err := g.Get(u)
if err != nil { if err != nil {
return "", err return "", err
...@@ -99,6 +101,7 @@ func (tr *typeResolver) ResolveTypes(config *common.Configuration, imports []*co ...@@ -99,6 +101,7 @@ func (tr *typeResolver) ResolveTypes(config *common.Configuration, imports []*co
// TODO(vaikas): Need to account for multiple URLs being fetched for a given type. // TODO(vaikas): Need to account for multiple URLs being fetched for a given type.
toFetch := make([]*fetchUnit, 0, tr.maxUrls) toFetch := make([]*fetchUnit, 0, tr.maxUrls)
for _, r := range config.Resources { for _, r := range config.Resources {
log.Printf("checking: %s", r.Type)
// Map the type to a fetchable URL (if applicable) or skip it if it's a non-fetchable type (primitive for example). // Map the type to a fetchable URL (if applicable) or skip it if it's a non-fetchable type (primitive for example).
urls, err := tr.MapFetchableURLs(r.Type) urls, err := tr.MapFetchableURLs(r.Type)
if err != nil { if err != nil {
...@@ -121,7 +124,9 @@ func (tr *typeResolver) ResolveTypes(config *common.Configuration, imports []*co ...@@ -121,7 +124,9 @@ func (tr *typeResolver) ResolveTypes(config *common.Configuration, imports []*co
} }
count := 0 count := 0
log.Printf("toFetch %#v", toFetch)
for len(toFetch) > 0 { for len(toFetch) > 0 {
log.Printf("toFetch2 %#v", toFetch)
// 1. If short github URL, resolve to a download URL // 1. If short github URL, resolve to a download URL
// 2. Fetch import URL. Exit if no URLs left // 2. Fetch import URL. Exit if no URLs left
// 3. Check/handle HTTP status // 3. Check/handle HTTP status
......
...@@ -48,7 +48,6 @@ func NewGithubPackageRegistry(owner, repository string) *GithubPackageRegistry { ...@@ -48,7 +48,6 @@ func NewGithubPackageRegistry(owner, repository string) *GithubPackageRegistry {
} }
// List the types from the Registry. // List the types from the Registry.
// TODO(vaikas): Figure out how the versions work here.
func (g *GithubPackageRegistry) List() ([]Type, error) { func (g *GithubPackageRegistry) List() ([]Type, error) {
// Just list all the types at the top level. // Just list all the types at the top level.
types, err := g.getDirs("") types, err := g.getDirs("")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment