-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Helm support to Python SDK (#544)
- Loading branch information
1 parent
29d2b48
commit 6c4b212
Showing
13 changed files
with
1,019 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
// Copyright 2016-2019, Pulumi Corporation. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package main | ||
|
||
import ( | ||
"fmt" | ||
"io" | ||
"io/ioutil" | ||
"os" | ||
"path" | ||
) | ||
|
||
// CopyFile copies a single file from src to dst | ||
// From https://blog.depado.eu/post/copy-files-and-directories-in-go | ||
func CopyFile(src, dst string) error { | ||
var err error | ||
var srcfd *os.File | ||
var dstfd *os.File | ||
var srcinfo os.FileInfo | ||
|
||
if srcfd, err = os.Open(src); err != nil { | ||
return err | ||
} | ||
defer srcfd.Close() | ||
|
||
if dstfd, err = os.Create(dst); err != nil { | ||
return err | ||
} | ||
defer dstfd.Close() | ||
|
||
if _, err = io.Copy(dstfd, srcfd); err != nil { | ||
return err | ||
} | ||
if srcinfo, err = os.Stat(src); err != nil { | ||
return err | ||
} | ||
return os.Chmod(dst, srcinfo.Mode()) | ||
} | ||
|
||
// CopyDir copies a whole directory recursively | ||
// From https://blog.depado.eu/post/copy-files-and-directories-in-go | ||
func CopyDir(src string, dst string) error { | ||
var err error | ||
var fds []os.FileInfo | ||
var srcinfo os.FileInfo | ||
|
||
if srcinfo, err = os.Stat(src); err != nil { | ||
return err | ||
} | ||
|
||
if err = os.MkdirAll(dst, srcinfo.Mode()); err != nil { | ||
return err | ||
} | ||
|
||
if fds, err = ioutil.ReadDir(src); err != nil { | ||
return err | ||
} | ||
for _, fd := range fds { | ||
srcfp := path.Join(src, fd.Name()) | ||
dstfp := path.Join(dst, fd.Name()) | ||
|
||
if fd.IsDir() { | ||
if err = CopyDir(srcfp, dstfp); err != nil { | ||
fmt.Println(err) | ||
} | ||
} else { | ||
if err = CopyFile(srcfp, dstfp); err != nil { | ||
fmt.Println(err) | ||
} | ||
} | ||
} | ||
return nil | ||
} |
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,8 @@ | ||
# coding=utf-8 | ||
# *** WARNING: this file was generated by the Pulumi Kubernetes codegen tool. *** | ||
# *** Do not edit by hand unless you're certain you know what you are doing! *** | ||
|
||
# Make subpackages available: | ||
__all__ = [ | ||
"v2", | ||
] |
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,6 @@ | ||
# coding=utf-8 | ||
# *** WARNING: this file was generated by the Pulumi Kubernetes codegen tool. *** | ||
# *** Do not edit by hand unless you're certain you know what you are doing! *** | ||
|
||
# Export this package's modules as members: | ||
from .helm import * |
Oops, something went wrong.