-
Notifications
You must be signed in to change notification settings - Fork 594
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Daishan
committed
Feb 24, 2020
1 parent
8d05697
commit d2d7276
Showing
12 changed files
with
4,486 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"io/ioutil" | ||
"net/http" | ||
"os" | ||
|
||
"github.com/rancher/rke/metadata" | ||
) | ||
|
||
const ( | ||
defaultURL = "https://releases.rancher.com/kontainer-driver-metadata/dev-v2.4/data.json" | ||
dataFile = "data/data.json" | ||
) | ||
|
||
// Codegen fetch data.json from https://releases.rancher.com/kontainer-driver-metadata/dev-v2.4/data.json and generates bindata | ||
func main() { | ||
u := os.Getenv(metadata.RancherMetadataURLEnv) | ||
if u == "" { | ||
u = defaultURL | ||
} | ||
data, err := http.Get(u) | ||
if err != nil { | ||
panic(fmt.Errorf("failed to fetch data.json from kontainer-driver-metadata repository")) | ||
} | ||
defer data.Body.Close() | ||
|
||
b, err := ioutil.ReadAll(data.Body) | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
fmt.Println("Writing data") | ||
if err := ioutil.WriteFile(dataFile, b, 0755); err != nil { | ||
return | ||
} | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.