Re: [Freeipa-devel] [PATCH 0151-0152] install: Call hostnamectl set-hostname only if --hostname option is use server-install: Fix --hostname option to always override api.env value

2016-08-10 Thread Jan Cholasta

On 10.8.2016 10:09, Petr Spacek wrote:

On 10.8.2016 08:21, Jan Cholasta wrote:

On 1.8.2016 17:42, Petr Spacek wrote:

On 1.8.2016 08:27, Jan Cholasta wrote:

On 28.7.2016 16:55, Petr Spacek wrote:

On 28.7.2016 16:44, Jan Cholasta wrote:

On 28.7.2016 16:37, Petr Spacek wrote:

On 28.7.2016 16:35, Jan Cholasta wrote:

On 28.7.2016 16:20, Petr Spacek wrote:

Hello,

install: Call hostnamectl set-hostname only if --hostname option is used

This commit also splits hostname backup and configuration into two
separate
functions. This allows us to backup hostname without setting it at the
same time.

https://fedorahosted.org/freeipa/ticket/6071


Note that you can set ca_host in cfg unconditionally, the value is only
valid
during install and is not written anywhere.


I prefer not to set it so the code blows up when we attempt to touch
variables
we should reference in particular setups. I.e. Take this as a first step
towards api.env without invalid values :-)


OK. Use the proper condition then ("if setup_ca:").


Oh, I'm probably blind. Here is revised version.


But you used "if not setup_ca:" rather than "if setup_ca:" :-)


This patch set is cursed!


The host name should not be backed up in server install if we are not changing
it, so that it's not attempted to be changed on uninstall.

Otherwise works for me.


Okay, now I see that ipa-backup/restore is storing the host name in backup
header so we do not need it in sysrestore.

New patches are attached.


Thanks, ACK.

Pushed to master: 80e544e7a98ff22469e9d3a4f7bda2ed234601aa

--
Jan Cholasta

--
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code


Re: [Freeipa-devel] [PATCH 0151-0152] install: Call hostnamectl set-hostname only if --hostname option is use server-install: Fix --hostname option to always override api.env value

2016-08-10 Thread Petr Spacek
On 10.8.2016 08:21, Jan Cholasta wrote:
> On 1.8.2016 17:42, Petr Spacek wrote:
>> On 1.8.2016 08:27, Jan Cholasta wrote:
>>> On 28.7.2016 16:55, Petr Spacek wrote:
 On 28.7.2016 16:44, Jan Cholasta wrote:
> On 28.7.2016 16:37, Petr Spacek wrote:
>> On 28.7.2016 16:35, Jan Cholasta wrote:
>>> On 28.7.2016 16:20, Petr Spacek wrote:
 Hello,

 install: Call hostnamectl set-hostname only if --hostname option is 
 used

 This commit also splits hostname backup and configuration into two
 separate
 functions. This allows us to backup hostname without setting it at the
 same time.

 https://fedorahosted.org/freeipa/ticket/6071
>>>
>>> Note that you can set ca_host in cfg unconditionally, the value is only
>>> valid
>>> during install and is not written anywhere.
>>
>> I prefer not to set it so the code blows up when we attempt to touch
>> variables
>> we should reference in particular setups. I.e. Take this as a first step
>> towards api.env without invalid values :-)
>
> OK. Use the proper condition then ("if setup_ca:").

 Oh, I'm probably blind. Here is revised version.
>>>
>>> But you used "if not setup_ca:" rather than "if setup_ca:" :-)
>>
>> This patch set is cursed!
> 
> The host name should not be backed up in server install if we are not changing
> it, so that it's not attempted to be changed on uninstall.
> 
> Otherwise works for me.

Okay, now I see that ipa-backup/restore is storing the host name in backup
header so we do not need it in sysrestore.

New patches are attached.

-- 
Petr^2 Spacek
From 96010d6f9d480c6eac39816f449bc647fd6b36c1 Mon Sep 17 00:00:00 2001
From: Petr Spacek 
Date: Tue, 12 Jul 2016 17:42:40 +0200
Subject: [PATCH] server-install: Fix --hostname option to always override
 api.env values

Attempts to compare local hostname with user-provided values are error
prone as we found out in #5794. This patch removes comparison and makes
the env values deterministic.

https://fedorahosted.org/freeipa/ticket/6071
---
 ipaserver/install/server/install.py | 13 +
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/ipaserver/install/server/install.py b/ipaserver/install/server/install.py
index 65f9318201e648b30a3c13626e807ac6f3a9416d..1e925595b93ff95a98b3e6c3d0c357b1766dc1dc 100644
--- a/ipaserver/install/server/install.py
+++ b/ipaserver/install/server/install.py
@@ -560,7 +560,12 @@ def install_check(installer):
 cfg = dict(
 context='installer',
 in_server=True,
+# make sure host name specified by user is used instead of default
+host=host_name,
 )
+if setup_ca:
+# we have an IPA-integrated CA
+cfg['ca_host'] = host_name
 
 # Create the management framework config file and finalize api
 target_fname = paths.IPA_DEFAULT_CONF
@@ -586,14 +591,6 @@ def install_check(installer):
 # Must be readable for everyone
 os.chmod(target_fname, 0o644)
 
-system_hostname = get_fqdn()
-if host_name != system_hostname:
-root_logger.debug("Chosen hostname (%s) differs from system hostname "
-  "(%s) - change it" % (host_name, system_hostname))
-# update `api.env.ca_host` to correct hostname
-# https://fedorahosted.org/freeipa/ticket/4936
-api.env.ca_host = host_name
-
 api.bootstrap(**cfg)
 api.finalize()
 
-- 
2.7.4

From d546592834ea7b08908acf66d668c05203734c76 Mon Sep 17 00:00:00 2001
From: Petr Spacek 
Date: Thu, 28 Jul 2016 16:13:55 +0200
Subject: [PATCH] install: Call hostnamectl set-hostname only if --hostname
 option is used

This commit also splits hostname backup and configuration into two separate
functions. This allows us to backup hostname without setting it at the
same time.

https://fedorahosted.org/freeipa/ticket/6071
---
 client/ipa-client-install   |  3 ++-
 doc/guide/guide.org | 10 +-
 ipaplatform/base/tasks.py   |  7 ++-
 ipaplatform/redhat/tasks.py | 13 ++---
 ipaserver/install/server/install.py | 10 +-
 5 files changed, 16 insertions(+), 27 deletions(-)

diff --git a/client/ipa-client-install b/client/ipa-client-install
index 05b6b6e0da07353750d0dca4e6df9d1f58d69c35..4a263b3d0e25960fc57d198e3efb24447cbed98e 100755
--- a/client/ipa-client-install
+++ b/client/ipa-client-install
@@ -2525,7 +2525,8 @@ def install(options, env, fstore, statestore):
 if options.hostname and not options.on_master:
 # skip this step when run by ipa-server-install as it always configures
 # hostname
-tasks.backup_and_replace_hostname(fstore, statestore, options.hostname)
+tasks.backup_hostname(fstore, statestore)
+tasks.set_hostname(options.hostname)
 
 ntp_srv_servers = []
 if not options.on_master and options.conf_ntp:
diff --git 

Re: [Freeipa-devel] [PATCH 0151-0152] install: Call hostnamectl set-hostname only if --hostname option is use server-install: Fix --hostname option to always override api.env value

2016-08-10 Thread Jan Cholasta

On 1.8.2016 17:42, Petr Spacek wrote:

On 1.8.2016 08:27, Jan Cholasta wrote:

On 28.7.2016 16:55, Petr Spacek wrote:

On 28.7.2016 16:44, Jan Cholasta wrote:

On 28.7.2016 16:37, Petr Spacek wrote:

On 28.7.2016 16:35, Jan Cholasta wrote:

On 28.7.2016 16:20, Petr Spacek wrote:

Hello,

install: Call hostnamectl set-hostname only if --hostname option is used

This commit also splits hostname backup and configuration into two separate
functions. This allows us to backup hostname without setting it at the
same time.

https://fedorahosted.org/freeipa/ticket/6071


Note that you can set ca_host in cfg unconditionally, the value is only
valid
during install and is not written anywhere.


I prefer not to set it so the code blows up when we attempt to touch
variables
we should reference in particular setups. I.e. Take this as a first step
towards api.env without invalid values :-)


OK. Use the proper condition then ("if setup_ca:").


Oh, I'm probably blind. Here is revised version.


But you used "if not setup_ca:" rather than "if setup_ca:" :-)


This patch set is cursed!


The host name should not be backed up in server install if we are not 
changing it, so that it's not attempted to be changed on uninstall.


Otherwise works for me.



Petr^2 Spacek





Petr^2 Spacek





(In my stash I have a patch which removes nonsense defaults from
ipalib.constants. To be pushed when we a new git branch for 4.4...)

Petr^2 Spacek


server-install: Fix --hostname option to always override api.env values

Attempts to compare local hostname with user-provided values are error
prone as we found out in #5794. This patch removes comparison and makes
the env values deterministic.

https://fedorahosted.org/freeipa/ticket/6071


Jan, this patch set should fix problems you have seen in containers.









--
Jan Cholasta

--
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code


Re: [Freeipa-devel] [PATCH 0151-0152] install: Call hostnamectl set-hostname only if --hostname option is use server-install: Fix --hostname option to always override api.env value

2016-08-01 Thread Petr Spacek
On 1.8.2016 08:27, Jan Cholasta wrote:
> On 28.7.2016 16:55, Petr Spacek wrote:
>> On 28.7.2016 16:44, Jan Cholasta wrote:
>>> On 28.7.2016 16:37, Petr Spacek wrote:
 On 28.7.2016 16:35, Jan Cholasta wrote:
> On 28.7.2016 16:20, Petr Spacek wrote:
>> Hello,
>>
>> install: Call hostnamectl set-hostname only if --hostname option is used
>>
>> This commit also splits hostname backup and configuration into two 
>> separate
>> functions. This allows us to backup hostname without setting it at the
>> same time.
>>
>> https://fedorahosted.org/freeipa/ticket/6071
>
> Note that you can set ca_host in cfg unconditionally, the value is only
> valid
> during install and is not written anywhere.

 I prefer not to set it so the code blows up when we attempt to touch
 variables
 we should reference in particular setups. I.e. Take this as a first step
 towards api.env without invalid values :-)
>>>
>>> OK. Use the proper condition then ("if setup_ca:").
>>
>> Oh, I'm probably blind. Here is revised version.
> 
> But you used "if not setup_ca:" rather than "if setup_ca:" :-)

This patch set is cursed!

Petr^2 Spacek

> 
>>
>> Petr^2 Spacek
>>
>>>

 (In my stash I have a patch which removes nonsense defaults from
 ipalib.constants. To be pushed when we a new git branch for 4.4...)

 Petr^2 Spacek

>> server-install: Fix --hostname option to always override api.env values
>>
>> Attempts to compare local hostname with user-provided values are error
>> prone as we found out in #5794. This patch removes comparison and makes
>> the env values deterministic.
>>
>> https://fedorahosted.org/freeipa/ticket/6071
>>
>>
>> Jan, this patch set should fix problems you have seen in containers.
> 
> 


-- 
Petr^2 Spacek
From 16c62d99391ec2efff93e0652bf00ecb72f37a42 Mon Sep 17 00:00:00 2001
From: Petr Spacek 
Date: Tue, 12 Jul 2016 17:42:40 +0200
Subject: [PATCH] server-install: Fix --hostname option to always override
 api.env values

Attempts to compare local hostname with user-provided values are error
prone as we found out in #5794. This patch removes comparison and makes
the env values deterministic.

https://fedorahosted.org/freeipa/ticket/6071
---
 ipaserver/install/server/install.py | 13 +
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/ipaserver/install/server/install.py b/ipaserver/install/server/install.py
index 65f9318201e648b30a3c13626e807ac6f3a9416d..1e925595b93ff95a98b3e6c3d0c357b1766dc1dc 100644
--- a/ipaserver/install/server/install.py
+++ b/ipaserver/install/server/install.py
@@ -560,7 +560,12 @@ def install_check(installer):
 cfg = dict(
 context='installer',
 in_server=True,
+# make sure host name specified by user is used instead of default
+host=host_name,
 )
+if setup_ca:
+# we have an IPA-integrated CA
+cfg['ca_host'] = host_name
 
 # Create the management framework config file and finalize api
 target_fname = paths.IPA_DEFAULT_CONF
@@ -586,14 +591,6 @@ def install_check(installer):
 # Must be readable for everyone
 os.chmod(target_fname, 0o644)
 
-system_hostname = get_fqdn()
-if host_name != system_hostname:
-root_logger.debug("Chosen hostname (%s) differs from system hostname "
-  "(%s) - change it" % (host_name, system_hostname))
-# update `api.env.ca_host` to correct hostname
-# https://fedorahosted.org/freeipa/ticket/4936
-api.env.ca_host = host_name
-
 api.bootstrap(**cfg)
 api.finalize()
 
-- 
2.7.4

From 719db115f1e02e1f1e635f3f8c16b234458d0703 Mon Sep 17 00:00:00 2001
From: Petr Spacek 
Date: Thu, 28 Jul 2016 16:13:55 +0200
Subject: [PATCH] install: Call hostnamectl set-hostname only if --hostname
 option is used

This commit also splits hostname backup and configuration into two separate
functions. This allows us to backup hostname without setting it at the
same time.

https://fedorahosted.org/freeipa/ticket/6071
---
 client/ipa-client-install   |  3 ++-
 doc/guide/guide.org | 10 +-
 ipaplatform/base/tasks.py   |  7 ++-
 ipaplatform/redhat/tasks.py | 13 ++---
 ipaserver/install/server/install.py | 10 +-
 5 files changed, 16 insertions(+), 27 deletions(-)

diff --git a/client/ipa-client-install b/client/ipa-client-install
index 05b6b6e0da07353750d0dca4e6df9d1f58d69c35..4a263b3d0e25960fc57d198e3efb24447cbed98e 100755
--- a/client/ipa-client-install
+++ b/client/ipa-client-install
@@ -2525,7 +2525,8 @@ def install(options, env, fstore, statestore):
 if options.hostname and not options.on_master:
 # skip this step when run by ipa-server-install as it always configures
 # hostname
-tasks.backup_and_replace_hostname(fstore, statestore, options.hostname)
+   

Re: [Freeipa-devel] [PATCH 0151-0152] install: Call hostnamectl set-hostname only if --hostname option is use server-install: Fix --hostname option to always override api.env value

2016-08-01 Thread Jan Cholasta

On 28.7.2016 16:55, Petr Spacek wrote:

On 28.7.2016 16:44, Jan Cholasta wrote:

On 28.7.2016 16:37, Petr Spacek wrote:

On 28.7.2016 16:35, Jan Cholasta wrote:

On 28.7.2016 16:20, Petr Spacek wrote:

Hello,

install: Call hostnamectl set-hostname only if --hostname option is used

This commit also splits hostname backup and configuration into two separate
functions. This allows us to backup hostname without setting it at the
same time.

https://fedorahosted.org/freeipa/ticket/6071


Note that you can set ca_host in cfg unconditionally, the value is only valid
during install and is not written anywhere.


I prefer not to set it so the code blows up when we attempt to touch variables
we should reference in particular setups. I.e. Take this as a first step
towards api.env without invalid values :-)


OK. Use the proper condition then ("if setup_ca:").


Oh, I'm probably blind. Here is revised version.


But you used "if not setup_ca:" rather than "if setup_ca:" :-)



Petr^2 Spacek





(In my stash I have a patch which removes nonsense defaults from
ipalib.constants. To be pushed when we a new git branch for 4.4...)

Petr^2 Spacek


server-install: Fix --hostname option to always override api.env values

Attempts to compare local hostname with user-provided values are error
prone as we found out in #5794. This patch removes comparison and makes
the env values deterministic.

https://fedorahosted.org/freeipa/ticket/6071


Jan, this patch set should fix problems you have seen in containers.



--
Jan Cholasta

--
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code


Re: [Freeipa-devel] [PATCH 0151-0152] install: Call hostnamectl set-hostname only if --hostname option is use server-install: Fix --hostname option to always override api.env value

2016-07-28 Thread Petr Spacek
On 28.7.2016 16:44, Jan Cholasta wrote:
> On 28.7.2016 16:37, Petr Spacek wrote:
>> On 28.7.2016 16:35, Jan Cholasta wrote:
>>> On 28.7.2016 16:20, Petr Spacek wrote:
 Hello,

 install: Call hostnamectl set-hostname only if --hostname option is used

 This commit also splits hostname backup and configuration into two separate
 functions. This allows us to backup hostname without setting it at the
 same time.

 https://fedorahosted.org/freeipa/ticket/6071
>>>
>>> Note that you can set ca_host in cfg unconditionally, the value is only 
>>> valid
>>> during install and is not written anywhere.
>>
>> I prefer not to set it so the code blows up when we attempt to touch 
>> variables
>> we should reference in particular setups. I.e. Take this as a first step
>> towards api.env without invalid values :-)
> 
> OK. Use the proper condition then ("if setup_ca:").

Oh, I'm probably blind. Here is revised version.

Petr^2 Spacek

> 
>>
>> (In my stash I have a patch which removes nonsense defaults from
>> ipalib.constants. To be pushed when we a new git branch for 4.4...)
>>
>> Petr^2 Spacek
>>
 server-install: Fix --hostname option to always override api.env values

 Attempts to compare local hostname with user-provided values are error
 prone as we found out in #5794. This patch removes comparison and makes
 the env values deterministic.

 https://fedorahosted.org/freeipa/ticket/6071


 Jan, this patch set should fix problems you have seen in containers.
From d61ab05a3d9d978146a50f66c1c757144c78b700 Mon Sep 17 00:00:00 2001
From: Petr Spacek 
Date: Tue, 12 Jul 2016 17:42:40 +0200
Subject: [PATCH] server-install: Fix --hostname option to always override
 api.env values

Attempts to compare local hostname with user-provided values are error
prone as we found out in #5794. This patch removes comparison and makes
the env values deterministic.

https://fedorahosted.org/freeipa/ticket/6071
---
 ipaserver/install/server/install.py | 13 +
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/ipaserver/install/server/install.py b/ipaserver/install/server/install.py
index c0c676b870b481696ae75742c7bf88074b0ecf9c..7e1c53b0575950302f90f9b7c9b8721df11f9b9e 100644
--- a/ipaserver/install/server/install.py
+++ b/ipaserver/install/server/install.py
@@ -559,7 +559,12 @@ def install_check(installer):
 cfg = dict(
 context='installer',
 in_server=True,
+# make sure host name specified by user is used instead of default
+host=host_name,
 )
+if not setup_ca:
+# we have an IPA-integrated CA
+cfg['ca_host'] = host_name
 
 # Create the management framework config file and finalize api
 target_fname = paths.IPA_DEFAULT_CONF
@@ -585,14 +590,6 @@ def install_check(installer):
 # Must be readable for everyone
 os.chmod(target_fname, 0o644)
 
-system_hostname = get_fqdn()
-if host_name != system_hostname:
-root_logger.debug("Chosen hostname (%s) differs from system hostname "
-  "(%s) - change it" % (host_name, system_hostname))
-# update `api.env.ca_host` to correct hostname
-# https://fedorahosted.org/freeipa/ticket/4936
-api.env.ca_host = host_name
-
 api.bootstrap(**cfg)
 api.finalize()
 
-- 
2.7.4

From acb5bb64bf23705a0d0efcf03d5f4015d9170f60 Mon Sep 17 00:00:00 2001
From: Petr Spacek 
Date: Thu, 28 Jul 2016 16:13:55 +0200
Subject: [PATCH] install: Call hostnamectl set-hostname only if --hostname
 option is used

This commit also splits hostname backup and configuration into two separate
functions. This allows us to backup hostname without setting it at the
same time.

https://fedorahosted.org/freeipa/ticket/6071
---
 client/ipa-client-install   |  3 ++-
 doc/guide/guide.org | 10 +-
 ipaplatform/base/tasks.py   |  7 ++-
 ipaplatform/redhat/tasks.py | 13 ++---
 ipaserver/install/server/install.py | 10 +-
 5 files changed, 16 insertions(+), 27 deletions(-)

diff --git a/client/ipa-client-install b/client/ipa-client-install
index 3c323173cc6f0a02aba1595f78637bbaac5a71ef..a4f15736bb20d83b305c6c14e7a51c469cd0e337 100755
--- a/client/ipa-client-install
+++ b/client/ipa-client-install
@@ -2518,7 +2518,8 @@ def install(options, env, fstore, statestore):
 if options.hostname and not options.on_master:
 # skip this step when run by ipa-server-install as it always configures
 # hostname
-tasks.backup_and_replace_hostname(fstore, statestore, options.hostname)
+tasks.backup_hostname(fstore, statestore)
+tasks.set_hostname(options.hostname)
 
 ntp_srv_servers = []
 if not options.on_master and options.conf_ntp:
diff --git a/doc/guide/guide.org b/doc/guide/guide.org
index 6d181559f0af90e7be7089aa94ab4900fa4e90b5..2e852a964991781ef5dd7b93ac481891897e1ed0 

Re: [Freeipa-devel] [PATCH 0151-0152] install: Call hostnamectl set-hostname only if --hostname option is use server-install: Fix --hostname option to always override api.env value

2016-07-28 Thread Jan Cholasta

On 28.7.2016 16:37, Petr Spacek wrote:

On 28.7.2016 16:35, Jan Cholasta wrote:

On 28.7.2016 16:20, Petr Spacek wrote:

Hello,

install: Call hostnamectl set-hostname only if --hostname option is used

This commit also splits hostname backup and configuration into two separate
functions. This allows us to backup hostname without setting it at the
same time.

https://fedorahosted.org/freeipa/ticket/6071


Note that you can set ca_host in cfg unconditionally, the value is only valid
during install and is not written anywhere.


I prefer not to set it so the code blows up when we attempt to touch variables
we should reference in particular setups. I.e. Take this as a first step
towards api.env without invalid values :-)


OK. Use the proper condition then ("if setup_ca:").



(In my stash I have a patch which removes nonsense defaults from
ipalib.constants. To be pushed when we a new git branch for 4.4...)

Petr^2 Spacek


server-install: Fix --hostname option to always override api.env values

Attempts to compare local hostname with user-provided values are error
prone as we found out in #5794. This patch removes comparison and makes
the env values deterministic.

https://fedorahosted.org/freeipa/ticket/6071


Jan, this patch set should fix problems you have seen in containers.



--
Jan Cholasta

--
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code


Re: [Freeipa-devel] [PATCH 0151-0152] install: Call hostnamectl set-hostname only if --hostname option is use server-install: Fix --hostname option to always override api.env value

2016-07-28 Thread Petr Spacek
On 28.7.2016 16:35, Jan Cholasta wrote:
> On 28.7.2016 16:20, Petr Spacek wrote:
>> Hello,
>>
>> install: Call hostnamectl set-hostname only if --hostname option is used
>>
>> This commit also splits hostname backup and configuration into two separate
>> functions. This allows us to backup hostname without setting it at the
>> same time.
>>
>> https://fedorahosted.org/freeipa/ticket/6071
> 
> Note that you can set ca_host in cfg unconditionally, the value is only valid
> during install and is not written anywhere.

I prefer not to set it so the code blows up when we attempt to touch variables
we should reference in particular setups. I.e. Take this as a first step
towards api.env without invalid values :-)

(In my stash I have a patch which removes nonsense defaults from
ipalib.constants. To be pushed when we a new git branch for 4.4...)

Petr^2 Spacek

>> server-install: Fix --hostname option to always override api.env values
>>
>> Attempts to compare local hostname with user-provided values are error
>> prone as we found out in #5794. This patch removes comparison and makes
>> the env values deterministic.
>>
>> https://fedorahosted.org/freeipa/ticket/6071
>>
>>
>> Jan, this patch set should fix problems you have seen in containers.
-- 
Petr^2 Spacek
-- 
Petr^2 Spacek
-- 
Petr^2 Spacek
-- 
Petr^2 Spacek
-- 
Petr^2 Spacek
-- 
Petr^2 Spacek
-- 
Petr^2 Spacek
-- 
Petr^2 Spacek
-- 
Petr^2 Spacek
-- 
Petr^2 Spacek
-- 
Petr^2 Spacek

-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code


[Freeipa-devel] [PATCH 0151-0152] install: Call hostnamectl set-hostname only if --hostname option is use server-install: Fix --hostname option to always override api.env value

2016-07-28 Thread Petr Spacek
Hello,

install: Call hostnamectl set-hostname only if --hostname option is used

This commit also splits hostname backup and configuration into two separate
functions. This allows us to backup hostname without setting it at the
same time.

https://fedorahosted.org/freeipa/ticket/6071

server-install: Fix --hostname option to always override api.env values

Attempts to compare local hostname with user-provided values are error
prone as we found out in #5794. This patch removes comparison and makes
the env values deterministic.

https://fedorahosted.org/freeipa/ticket/6071


Jan, this patch set should fix problems you have seen in containers.

-- 
Petr^2 Spacek
From 39a514f6818811d45e495da9bff7411df199a3fb Mon Sep 17 00:00:00 2001
From: Petr Spacek 
Date: Tue, 12 Jul 2016 17:42:40 +0200
Subject: [PATCH] server-install: Fix --hostname option to always override
 api.env values

Attempts to compare local hostname with user-provided values are error
prone as we found out in #5794. This patch removes comparison and makes
the env values deterministic.

https://fedorahosted.org/freeipa/ticket/6071
---
 ipaserver/install/server/install.py | 13 +
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/ipaserver/install/server/install.py b/ipaserver/install/server/install.py
index c0c676b870b481696ae75742c7bf88074b0ecf9c..5d24a1358e7a5aeda1b23f92e7146efd6f629bbb 100644
--- a/ipaserver/install/server/install.py
+++ b/ipaserver/install/server/install.py
@@ -559,7 +559,12 @@ def install_check(installer):
 cfg = dict(
 context='installer',
 in_server=True,
+# make sure host name specified by user is used instead of default
+host=host_name,
 )
+if not (options.http_cert_files or options.dirsrv_cert_files):
+# we have an IPA-integrated CA
+cfg['ca_host'] = host_name
 
 # Create the management framework config file and finalize api
 target_fname = paths.IPA_DEFAULT_CONF
@@ -585,14 +590,6 @@ def install_check(installer):
 # Must be readable for everyone
 os.chmod(target_fname, 0o644)
 
-system_hostname = get_fqdn()
-if host_name != system_hostname:
-root_logger.debug("Chosen hostname (%s) differs from system hostname "
-  "(%s) - change it" % (host_name, system_hostname))
-# update `api.env.ca_host` to correct hostname
-# https://fedorahosted.org/freeipa/ticket/4936
-api.env.ca_host = host_name
-
 api.bootstrap(**cfg)
 api.finalize()
 
-- 
2.7.4

From fab9a97c62da4a6d08908e4e243af9a319a17e68 Mon Sep 17 00:00:00 2001
From: Petr Spacek 
Date: Thu, 28 Jul 2016 16:13:55 +0200
Subject: [PATCH] install: Call hostnamectl set-hostname only if --hostname
 option is used

This commit also splits hostname backup and configuration into two separate
functions. This allows us to backup hostname without setting it at the
same time.

https://fedorahosted.org/freeipa/ticket/6071
---
 client/ipa-client-install   |  3 ++-
 doc/guide/guide.org | 10 +-
 ipaplatform/base/tasks.py   |  7 ++-
 ipaplatform/redhat/tasks.py | 13 ++---
 ipaserver/install/server/install.py | 10 +-
 5 files changed, 16 insertions(+), 27 deletions(-)

diff --git a/client/ipa-client-install b/client/ipa-client-install
index 3c323173cc6f0a02aba1595f78637bbaac5a71ef..a4f15736bb20d83b305c6c14e7a51c469cd0e337 100755
--- a/client/ipa-client-install
+++ b/client/ipa-client-install
@@ -2518,7 +2518,8 @@ def install(options, env, fstore, statestore):
 if options.hostname and not options.on_master:
 # skip this step when run by ipa-server-install as it always configures
 # hostname
-tasks.backup_and_replace_hostname(fstore, statestore, options.hostname)
+tasks.backup_hostname(fstore, statestore)
+tasks.set_hostname(options.hostname)
 
 ntp_srv_servers = []
 if not options.on_master and options.conf_ntp:
diff --git a/doc/guide/guide.org b/doc/guide/guide.org
index 6d181559f0af90e7be7089aa94ab4900fa4e90b5..2e852a964991781ef5dd7b93ac481891897e1ed0 100644
--- a/doc/guide/guide.org
+++ b/doc/guide/guide.org
@@ -1039,14 +1039,14 @@ def restore_context_default(filepath):
 # version in platform services
 restore_context = restore_context_default
 
-# Default implementation of backup and replace hostname that does nothing
-def backup_and_replace_hostname_default(fstore, statestore, hostname):
+# Default implementation of backup hostname that does nothing
+def backup_hostname_default(fstore, statestore):
 return
 
-# Backup and replace system's hostname
-# Since many platforms have their own way how to store system's hostname, this method must be
+# Backup system's hostname
+# Since many platforms have their own way of handling system's hostname, this method must be
 # implemented in platform services
-backup_and_replace_hostname =