Change Agent.user to Agent.username and make it and hostname rw.

This commit is contained in:
Daniel Nichter
2013-04-10 16:57:06 -06:00
parent 9fbfa89c87
commit 7bfc694be4
2 changed files with 17 additions and 15 deletions

View File

@@ -1244,8 +1244,15 @@ has 'uuid' => (
required => 0, required => 0,
); );
has 'username' => (
is => 'rw',
isa => 'Str',
required => 1,
default => $ENV{USER} || $ENV{LOGNAME},
);
has 'hostname' => ( has 'hostname' => (
is => 'ro', is => 'rw',
isa => 'Str', isa => 'Str',
required => 1, required => 1,
); );
@@ -1256,12 +1263,6 @@ has 'alias' => (
required => 0, required => 0,
); );
has 'user' => (
is => 'ro',
isa => 'Str',
required => 1,
);
has 'versions' => ( has 'versions' => (
is => 'ro', is => 'ro',
isa => 'Maybe[HashRef]', isa => 'Maybe[HashRef]',
@@ -5052,7 +5053,7 @@ sub init_agent {
# Other optional attribs, like versions, are left to the caller. # Other optional attribs, like versions, are left to the caller.
chomp(my $hostname = `hostname`); chomp(my $hostname = `hostname`);
$agent->{hostname} = $hostname; $agent->{hostname} = $hostname;
$agent->{user} = $ENV{USER} || $ENV{LOGNAME}; $agent->{username} = $ENV{USER} || $ENV{LOGNAME};
# Try forever to create/update the Agent. The tool can't # Try forever to create/update the Agent. The tool can't
# do anything without an Agent, so we must succeed to proceed. # do anything without an Agent, so we must succeed to proceed.

View File

@@ -28,8 +28,15 @@ has 'uuid' => (
required => 0, required => 0,
); );
has 'username' => (
is => 'rw',
isa => 'Str',
required => 1,
default => $ENV{USER} || $ENV{LOGNAME},
);
has 'hostname' => ( has 'hostname' => (
is => 'ro', is => 'rw',
isa => 'Str', isa => 'Str',
required => 1, required => 1,
); );
@@ -40,12 +47,6 @@ has 'alias' => (
required => 0, required => 0,
); );
has 'user' => (
is => 'ro',
isa => 'Str',
required => 1,
);
has 'versions' => ( has 'versions' => (
is => 'ro', is => 'ro',
isa => 'Maybe[HashRef]', isa => 'Maybe[HashRef]',