s/QDN/GUN

This commit is contained in:
Diogo Monica 2015-06-17 13:31:13 -07:00
parent 26f694196e
commit ff169897b6
2 changed files with 28 additions and 28 deletions

View File

@ -44,16 +44,16 @@ var cmdKeysRemove = &cobra.Command{
} }
var cmdKeysTrust = &cobra.Command{ var cmdKeysTrust = &cobra.Command{
Use: "trust [ QDN ] [ certificate ]", Use: "trust [ certificate ]",
Short: "Trusts a new certificate for a specific QDN.", Short: "Trusts a new certificate for a specific GUN.",
Long: "Adds a the certificate to the trusted certificate authority list for the specified Qualified Docker Name.", Long: "Adds a the certificate to the trusted certificate authority list for the specified Global Unique Name.",
Run: keysTrust, Run: keysTrust,
} }
var cmdKeysGenerate = &cobra.Command{ var cmdKeysGenerate = &cobra.Command{
Use: "generate [ QDN ]", Use: "generate [ GUN ]",
Short: "Generates a new key for a specific QDN.", Short: "Generates a new key for a specific GUN.",
Long: "generates a new key for a specific QDN. Qualified Docker Name.", Long: "generates a new key for a specific GUN. Global Unique Name.",
Run: keysGenerate, Run: keysGenerate,
} }
@ -152,10 +152,10 @@ func keysList(cmd *cobra.Command, args []string) {
func keysGenerate(cmd *cobra.Command, args []string) { func keysGenerate(cmd *cobra.Command, args []string) {
if len(args) < 1 { if len(args) < 1 {
cmd.Usage() cmd.Usage()
fatalf("must specify a QDN") fatalf("must specify a GUN")
} }
// (diogo): Validate QDNs // (diogo): Validate GUNs
qualifiedDN := args[0] qualifiedDN := args[0]
key, err := generateKey(qualifiedDN) key, err := generateKey(qualifiedDN)

View File

@ -39,42 +39,42 @@ func init() {
} }
var cmdTufAdd = &cobra.Command{ var cmdTufAdd = &cobra.Command{
Use: "add [ QDN ] <target> <file path>", Use: "add [ GUN ] <target> <file path>",
Short: "pushes local updates.", Short: "pushes local updates.",
Long: "pushes all local updates within a specific TUF repo to remote trust server.", Long: "pushes all local updates within a specific TUF repo to remote trust server.",
Run: tufAdd, Run: tufAdd,
} }
var cmdTufRemove = &cobra.Command{ var cmdTufRemove = &cobra.Command{
Use: "remove [ QDN ] <target>", Use: "remove [ GUN ] <target>",
Short: "Removes a target from the TUF repo.", Short: "Removes a target from the TUF repo.",
Long: "removes a target from the local TUF repo identified by a Qualified Docker Name.", Long: "removes a target from the local TUF repo identified by a Qualified Docker Name.",
Run: tufRemove, Run: tufRemove,
} }
var cmdTufInit = &cobra.Command{ var cmdTufInit = &cobra.Command{
Use: "init [ QDN ]", Use: "init [ GUN ]",
Short: "initializes the local TUF repository.", Short: "initializes the local TUF repository.",
Long: "creates locally the initial set of TUF metadata for the Qualified Docker Name.", Long: "creates locally the initial set of TUF metadata for the Qualified Docker Name.",
Run: tufInit, Run: tufInit,
} }
var cmdTufList = &cobra.Command{ var cmdTufList = &cobra.Command{
Use: "list [ QDN ]", Use: "list [ GUN ]",
Short: "Lists all targets in a TUF repository.", Short: "Lists all targets in a TUF repository.",
Long: "lists all the targets in the TUF repository identified by the Qualified Docker Name.", Long: "lists all the targets in the TUF repository identified by the Qualified Docker Name.",
Run: tufList, Run: tufList,
} }
var cmdTufLookup = &cobra.Command{ var cmdTufLookup = &cobra.Command{
Use: "lookup [ QDN ] <target name>", Use: "lookup [ GUN ] <target name>",
Short: "Looks up a specific TUF target in a repository.", Short: "Looks up a specific TUF target in a repository.",
Long: "looks up a TUF target in a repository given a Qualified Docker Name.", Long: "looks up a TUF target in a repository given a Qualified Docker Name.",
Run: tufLookup, Run: tufLookup,
} }
var cmdTufPush = &cobra.Command{ var cmdTufPush = &cobra.Command{
Use: "push [ QDN ]", Use: "push [ GUN ]",
Short: "initializes the local TUF repository.", Short: "initializes the local TUF repository.",
Long: "creates locally the initial set of TUF metadata for the Qualified Docker Name.", Long: "creates locally the initial set of TUF metadata for the Qualified Docker Name.",
Run: tufPush, Run: tufPush,
@ -83,17 +83,17 @@ var cmdTufPush = &cobra.Command{
func tufAdd(cmd *cobra.Command, args []string) { func tufAdd(cmd *cobra.Command, args []string) {
if len(args) < 3 { if len(args) < 3 {
cmd.Usage() cmd.Usage()
fatalf("must specify a QDN, target name, and local path to target data") fatalf("must specify a GUN, target name, and local path to target data")
} }
qdn := args[0] gun := args[0]
targetName := args[1] targetName := args[1]
targetPath := args[2] targetPath := args[2]
kdb := keys.NewDB() kdb := keys.NewDB()
repo := tuf.NewTufRepo(kdb, nil) repo := tuf.NewTufRepo(kdb, nil)
filestore, err := store.NewFilesystemStore( filestore, err := store.NewFilesystemStore(
path.Join(viper.GetString("tufDir"), qdn), // TODO: base trust dir from config path.Join(viper.GetString("tufDir"), gun), // TODO: base trust dir from config
"metadata", "metadata",
"json", "json",
"targets", "targets",
@ -157,15 +157,15 @@ func tufAdd(cmd *cobra.Command, args []string) {
func tufInit(cmd *cobra.Command, args []string) { func tufInit(cmd *cobra.Command, args []string) {
if len(args) < 1 { if len(args) < 1 {
cmd.Usage() cmd.Usage()
fatalf("must specify a QDN") fatalf("must specify a Global Unique Name")
} }
qdn := args[0] gun := args[0]
kdb := keys.NewDB() kdb := keys.NewDB()
repo := tuf.NewTufRepo(kdb, nil) repo := tuf.NewTufRepo(kdb, nil)
filestore, err := store.NewFilesystemStore( filestore, err := store.NewFilesystemStore(
path.Join(viper.GetString("tufDir"), qdn), // TODO: base trust dir from config path.Join(viper.GetString("tufDir"), gun), // TODO: base trust dir from config
"metadata", "metadata",
"json", "json",
"targets", "targets",
@ -181,24 +181,24 @@ func tufInit(cmd *cobra.Command, args []string) {
func tufList(cmd *cobra.Command, args []string) { func tufList(cmd *cobra.Command, args []string) {
if len(args) < 1 { if len(args) < 1 {
cmd.Usage() cmd.Usage()
fatalf("must specify a QDN") fatalf("must specify a Global Unique Name")
} }
} }
func tufLookup(cmd *cobra.Command, args []string) { func tufLookup(cmd *cobra.Command, args []string) {
if len(args) < 2 { if len(args) < 2 {
cmd.Usage() cmd.Usage()
fatalf("must specify a QDN and target path to look up.") fatalf("must specify a Global Unique Name and target path to look up.")
} }
fmt.Println("Remote trust server configured: " + remoteTrustServer) fmt.Println("Remote trust server configured: " + remoteTrustServer)
qdn := args[0] gun := args[0]
targetName := args[1] targetName := args[1]
kdb := keys.NewDB() kdb := keys.NewDB()
repo := tuf.NewTufRepo(kdb, nil) repo := tuf.NewTufRepo(kdb, nil)
remote, err := store.NewHTTPStore( remote, err := store.NewHTTPStore(
"https://localhost:4443/v2"+qdn+"/_trust/tuf/", "https://localhost:4443/v2"+gun+"/_trust/tuf/",
"", "",
"json", "json",
"", "",
@ -231,13 +231,13 @@ func tufLookup(cmd *cobra.Command, args []string) {
func tufPush(cmd *cobra.Command, args []string) { func tufPush(cmd *cobra.Command, args []string) {
if len(args) < 1 { if len(args) < 1 {
cmd.Usage() cmd.Usage()
fatalf("must specify a QDN") fatalf("must specify a Global Unique Name")
} }
qdn := args[0] gun := args[0]
remote, err := store.NewHTTPStore( remote, err := store.NewHTTPStore(
"https://localhost:4443/v2"+qdn+"/_trust/tuf/", "https://localhost:4443/v2"+gun+"/_trust/tuf/",
"", "",
"json", "json",
"", "",
@ -287,7 +287,7 @@ func tufPush(cmd *cobra.Command, args []string) {
func tufRemove(cmd *cobra.Command, args []string) { func tufRemove(cmd *cobra.Command, args []string) {
if len(args) < 1 { if len(args) < 1 {
cmd.Usage() cmd.Usage()
fatalf("must specify a QDN") fatalf("must specify a Global Unique Name")
} }
} }